08 2016 档案
摘要:题目: You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each
阅读全文
摘要:题目: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-
阅读全文
摘要:题目: Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), r
阅读全文
摘要:题目: We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess
阅读全文
摘要:题目: Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Given s = "hello", return "holle". Example 2:Give
阅读全文
摘要:题目: Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. Note: Each el
阅读全文
摘要:题目: Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each eleme
阅读全文
摘要:题目: Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: All root-to-leaf paths are:
阅读全文
摘要:题目: Description: Count the number of prime numbers less than a non-negative number, n. Credits:Special thanks to @mithmatt for adding this problem and
阅读全文
摘要:题目: Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom left corner and top right corner
阅读全文
摘要:题目: Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4,
阅读全文
摘要:1.开在栈里的数组(int a[n];)在出栈也就是函数结束时会释放掉,所以如果函数想返回一个数组的话,不能返回函数里面的数组的首地址,但是开在堆里(int *a=new int[n];)就可以。 2.栈空间有限,递归的时候注意层数不能太深,在函数里的数组不能太大。
阅读全文