上一页 1 2 3 4 5 6 7 8 9 ··· 28 下一页
摘要: Source Ugly number is a number that only have factors 3, 5 and 7. Design an algorithm to find the Kth ugly number. The first 5 ugly numbers are 3, 5, 阅读全文
posted @ 2021-09-12 10:28 凌雨尘 阅读(51) 评论(0) 推荐(0) 编辑
摘要: Source Count the number of k's between 0 and n. k can be 0 - 9. Example if n=12, k=1 in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], we have FIVE 1's ( 阅读全文
posted @ 2021-08-22 14:16 凌雨尘 阅读(33) 评论(0) 推荐(0) 编辑
摘要: Source Given an array of integers and a number k, the majority number is the number that occurs more than 1/k of the size of the array. Find it. Examp 阅读全文
posted @ 2021-08-08 19:08 凌雨尘 阅读(35) 评论(0) 推荐(0) 编辑
摘要: Source Given an array of integers, the majority number is the number that occurs more than 1/3 of the size of the array. Find it. Example Given [1, 2, 阅读全文
posted @ 2021-07-18 10:38 凌雨尘 阅读(35) 评论(0) 推荐(0) 编辑
摘要: Source Given an array of integers, the majority number is the number that occurs more than half of the size of the array. Find it. Example Given [1, 1 阅读全文
posted @ 2021-07-04 13:24 凌雨尘 阅读(63) 评论(0) 推荐(0) 编辑
摘要: Source Print numbers from 1 to the largest number with N digits by recursion. Example Given N = 1, return [1,2,3,4,5,6,7,8,9]. Given N = 2, return [1, 阅读全文
posted @ 2021-06-20 14:21 凌雨尘 阅读(38) 评论(0) 推荐(0) 编辑
摘要: Source Write a function that add two numbers A and B. You should not use + or any arithmetic operators. Example Given a=1 and b=2 return 3 Note There 阅读全文
posted @ 2021-06-06 16:14 凌雨尘 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 前言 C语言中,结构体内存对齐问题算是比较常见的问题,虽然理解起来不难,但很多时候一不小心就会算错。比如给你一个 struct,让你 sizeof 计算一下需要占用多少字节,往往得到的结果比等于 struct 里面数据成员所占用的字节之和。 例: #include <stdio.h> struct 阅读全文
posted @ 2021-05-23 11:38 凌雨尘 阅读(244) 评论(0) 推荐(0) 编辑
摘要: Source Find the Nth number in Fibonacci sequence. A Fibonacci sequence is defined as follow: The first two numbers are 0 and 1. The i th number is the 阅读全文
posted @ 2021-05-09 12:09 凌雨尘 阅读(152) 评论(0) 推荐(0) 编辑
摘要: Source Count how many 1 in binary representation of a 32-bit integer. Example Given 32, return 1 Given 5, return 2 Given 1023, return 9 Challenge If t 阅读全文
posted @ 2021-04-11 12:10 凌雨尘 阅读(51) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 28 下一页