随笔分类 -  Level 2

上一页 1 ··· 6 7 8 9 10 11 12 下一页
摘要:Determine the number of bits required to flip if you want to convert integer n to integer m. Notice Both n and m are 32-bit integers. Determine the nu 阅读全文
posted @ 2016-07-15 05:31 北叶青藤 阅读(204) 评论(0) 推荐(0)
摘要:There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it cost 阅读全文
posted @ 2016-07-15 02:06 北叶青藤 阅读(280) 评论(0) 推荐(0)
摘要:Given an integer array (index from 0 to n-1, where n is the size of this array), and an query list. Each query has two integers [start, end]. For each 阅读全文
posted @ 2016-07-14 21:35 北叶青藤 阅读(231) 评论(0) 推荐(0)
摘要:Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endp 阅读全文
posted @ 2016-07-14 08:50 北叶青藤 阅读(158) 评论(0) 推荐(0)
摘要:Implement pow(x, n). Notice You don't need to care about the precision of your answer, it's acceptable if the expected answer and your answer 's diffe 阅读全文
posted @ 2016-07-13 10:43 北叶青藤 阅读(186) 评论(0) 推荐(0)
摘要:Design a simplified version of Twitter where users can post tweets, follow/unfollow another user and is able to see the 10 most recent tweets in the u 阅读全文
posted @ 2016-07-13 02:00 北叶青藤 阅读(264) 评论(0) 推荐(0)
摘要:Given a binary tree, return all root-to-leaf paths. Example Given the following binary tree: 1 / \ 2 3 \ 5 All root-to-leaf paths are: [ "1->2->5", "1 阅读全文
posted @ 2016-07-12 07:21 北叶青藤 阅读(173) 评论(0) 推荐(0)
摘要: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, 阅读全文
posted @ 2016-07-12 06:49 北叶青藤 阅读(433) 评论(0) 推荐(0)
摘要:Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Example Given n = 12, retu 阅读全文
posted @ 2016-07-12 02:04 北叶青藤 阅读(249) 评论(0) 推荐(0)
摘要:Given two binary strings, return their sum (also a binary string). Example a = 11 b = 1 Return 100 分析: 这个和10进制加法一样。 total = a + b + carryover; digit = 阅读全文
posted @ 2016-07-10 23:51 北叶青藤 阅读(172) 评论(0) 推荐(0)
摘要:Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is a 阅读全文
posted @ 2016-07-10 23:04 北叶青藤 阅读(239) 评论(0) 推荐(0)
摘要:Write a method to replace all spaces in a string with %20. The string is given in a characters array, you can assume it has enough space for replaceme 阅读全文
posted @ 2016-07-10 12:39 北叶青藤 阅读(214) 评论(0) 推荐(0)
摘要:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. Notice Bonus point if you 阅读全文
posted @ 2016-07-10 08:46 北叶青藤 阅读(204) 评论(0) 推荐(0)
摘要:Given an integer array, heapify it into a min-heap array. For a heap array A, A[0] is the root of heap, and for each A[i], A[i * 2 + 1] is the left ch 阅读全文
posted @ 2016-07-10 07:05 北叶青藤 阅读(410) 评论(0) 推荐(0)
摘要:You have two every large binary trees: T1, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a subtree of 阅读全文
posted @ 2016-07-09 12:52 北叶青藤 阅读(363) 评论(0) 推荐(0)
摘要:Given an unsorted integer array, find the first missing positive integer. Example Given [1,2,0] return 3,and [3,4,-1,1] return 2. 分析: 我们只需要把1到A.length 阅读全文
posted @ 2016-07-09 12:24 北叶青藤 阅读(208) 评论(0) 推荐(0)
摘要:There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. Yo 阅读全文
posted @ 2016-07-09 03:53 北叶青藤 阅读(282) 评论(0) 推荐(0)
摘要:Segment Tree Query I For an integer array (index from 0 to n-1, where n is the size of this array), in the corresponding SegmentTree, each node stores 阅读全文
posted @ 2016-07-09 00:37 北叶青藤 阅读(270) 评论(0) 推荐(0)
摘要:Segment Tree Build I The structure of Segment Tree is a binary tree which each node has two attributes start and end denote an segment / interval. sta 阅读全文
posted @ 2016-07-09 00:15 北叶青藤 阅读(153) 评论(0) 推荐(0)
摘要:Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l 阅读全文
posted @ 2016-07-08 11:30 北叶青藤 阅读(152) 评论(0) 推荐(0)

上一页 1 ··· 6 7 8 9 10 11 12 下一页