- 博客(8)
- 收藏
- 关注
原创 [leetcode][javascript]Reverse Integer
Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to show spoilers. Have you thought about this? Here are some good questions to ask before c
2015-06-24 22:22:45
568
原创 [leetcode][javascript]Reverse Bits
Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 001110010
2015-06-24 21:15:37
981
原创 [leetcode][javascript]Number of 1 Bits
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-bit integer ’11' has binary representation 00000000
2015-06-24 14:01:12
312
原创 [leetcode][javascript]Happy Number
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 the number by the sum of the squares
2015-06-23 22:08:40
606
原创 [leetcode][javascript]Remove Linked List Elements
Remove Linked List Elements 两个版本,一个原始版(196ms),一个略微优化过的版本(176ms) 感觉leetcode对js的支持还是有些问题,两版本提交的结果还是有些差异的。 /** * Definition for singly-linked list. * function ListNode(val) { * this
2015-06-23 20:33:56
598
原创 Count Primes
Description: Count the number of prime numbers less than a non-negative number, n. 有三点优化 偶数排除掉只除已经判别出来的素数只除小于目标数平方根的数 此题决计还有很多优化空间。(待续) /** * @param {number} n * @return {number
2015-06-22 22:37:41
698
原创 Isomorphic Strings
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 character must be replaced with anot
2015-06-22 21:05:01
284
原创 Roman to Integer
Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. /** * @param {string} s * @return {number} */ var romanToInt = function(s) {
2015-06-22 20:11:51
257
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人