加载中
反转二叉树

原题   Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9   to 4 / \ 7 2 / \ / \ 9 6 3 1 题目大意   将一棵二叉树进行翻转。 解题思...

2016/12/28 12:04
46
用队列实现栈操作

原题   Implement the following operations of a stack using queues.   push(x) – Push element x onto stack.   pop() – Removes the element on top of the stack.   top() –...

2016/12/28 12:02
39
矩形区域

原题   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 as shown in the fi...

2016/12/28 12:01
27
包含重复元素II

原题   Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference betwee...

2016/12/28 12:01
7
包含重复元素

题目大意   给定一个整数数组,判断数组中是否包含重复元素。如果数组中任意一个数字出现了至少两次,你的函数应该返回true,如果每一个元素都是唯一的,返回false。 解题思路   用set数...

2016/12/28 12:00
3
组合数的和

原题   Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of n...

2016/12/28 11:59
12
数组中第K大的数

原题   Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.   For example,   Given...

2016/12/28 11:08
367
反转一个单链表

原题   Reverse a singly linked list. 题目大意   反转单链表。 解题思路   使用头插法。 代码实现 结点类 public class ListNode { int val; ListNode next; ListNode(i...

2016/12/28 11:08
5
同构字符串

原题   Given two strings s and t, determine if they are isomorphic.   Two strings are isomorphic if the characters in s can be replaced to get t.   All occurrences of a ch...

2016/12/28 11:07
389
统计质数

原题   Description:   Count the number of prime numbers less than a non-negative number, n. 题目大意   统计小于非负整数n的素数的个数。 解题思路   使用见埃拉托色尼筛法。 ...

2016/12/28 11:06
57
删除单链表中的元素

原题   Remove all elements from a linked list of integers that have value val.   Example   Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6   Return: 1 --> 2 --> 3...

2016/12/27 18:02
46
开心数字

原题   Write an algorithm to determine if a number is “happy”.   A happy number is a number defined by the following process: Starting with any positive integer, replace ...

2016/12/27 18:01
50
范围数位与结果

原题   Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.   For example, given the range [5, 7], you shou...

2016/12/27 17:59
44
岛的数目

原题   Given a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horiz...

2016/12/27 17:57
7
从右边看二叉树

原题   Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.   For example:   Giv...

2016/12/27 17:56
255
抢劫犯

原题   You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing ea...

2016/12/27 17:55
6
反转二制

原题   Reverse bits of a given 32 bits unsigned integer.   For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (...

2016/12/27 17:50
3
旋转数组

原题   Rotate an array of n elements to the right by k steps.   For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].   Note:   Try...

2016/12/27 17:47
2
子数组的最大乘积

原题   Find the contiguous subarray within an array (containing at least one number) which has the largest product.   For example, given the array [2,3,-2,4],   the conti...

2016/12/27 17:46
69
阶乘尾后0的数目

原题   Given an integer n, return the number of trailing zeroes in n!.   Note: Your solution should be in logarithmic time complexity. 题目大意   给定一个整数n,求阶乘结果...

2016/12/27 16:55
45

没有更多内容

加载失败,请刷新页面

返回顶部
顶部