1 2 3 4 5 ··· 15 下一页
摘要: Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity. The definition of a celebrity is tha 阅读全文
posted @ 2016-10-13 12:08 Machelsky 阅读(189) 评论(0) 推荐(0)
摘要: All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to 阅读全文
posted @ 2016-10-13 11:40 Machelsky 阅读(197) 评论(0) 推荐(0)
摘要: Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 思路:有多少个0就是有多少个5. 零的产生就是5 阅读全文
posted @ 2016-10-13 10:31 Machelsky 阅读(126) 评论(0) 推荐(0)
摘要: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up:Could you do this in-place? 思路:对角线对称呼唤,Y 阅读全文
posted @ 2016-10-13 10:15 Machelsky 阅读(156) 评论(0) 推荐(0)
摘要: Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Suppose a 阅读全文
posted @ 2016-10-13 09:36 Machelsky 阅读(151) 评论(0) 推荐(0)
摘要: 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 occurrenc 阅读全文
posted @ 2016-10-12 16:54 Machelsky 阅读(155) 评论(0) 推荐(0)
摘要: You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston 阅读全文
posted @ 2016-10-12 16:35 Machelsky 阅读(114) 评论(0) 推荐(0)
摘要: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the 阅读全文
posted @ 2016-10-12 15:55 Machelsky 阅读(194) 评论(0) 推荐(0)
摘要: Follow up for "Remove Duplicates":What if duplicates are allowed at most twice? For example,Given sorted array nums = [1,1,1,2,2,3], Your function sho 阅读全文
posted @ 2016-10-12 15:06 Machelsky 阅读(158) 评论(0) 推荐(0)
摘要: Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For exa 阅读全文
posted @ 2016-10-12 14:56 Machelsky 阅读(129) 评论(0) 推荐(0)
1 2 3 4 5 ··· 15 下一页