LeetCode
michaelee96
这个作者很懒,什么都没留下…
展开
-
1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the sam原创 2017-05-29 23:09:16 · 395 阅读 · 0 评论 -
461. Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.Note:0 ≤ x,原创 2017-05-30 10:59:54 · 202 阅读 · 0 评论 -
557. Reverse Words in a String III
一个骚操作原创 2017-06-01 08:39:45 · 265 阅读 · 0 评论 -
69. Sqrt(x)
Implement int sqrt(int x).Compute and return the square root of x.实现一个求平方根的算法,直接调用sqrt好像也行,不过不能用float,要用int记录(2147395599开平方是46339.99989,如果用float直接变成46340)。int mySqrt(int x) { int a=sqr原创 2017-06-07 16:48:52 · 244 阅读 · 0 评论 -
174. Dungeon Game
The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 2D grid. Our valiant knight (K) was initially p原创 2017-06-07 18:21:53 · 223 阅读 · 1 评论