12 2015 档案

摘要:Description:Count the number of prime numbers less than a non-negative number, n.Credits:Special thanks to @mithmatt for adding this problem and creat... 阅读全文
posted @ 2015-12-30 10:49 0giant 阅读(268) 评论(0) 推荐(0) 编辑
摘要:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font ... 阅读全文
posted @ 2015-12-28 09:42 0giant 阅读(253) 评论(0) 推荐(0) 编辑
摘要:Example1: x = 123, return 321Example2: x = -123, return -321 click to show spoilers.Have you thought about this?Here are some good questions to ask be... 阅读全文
posted @ 2015-12-24 16:09 0giant 阅读(195) 评论(0) 推荐(0) 编辑
摘要:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Subscribe to see which com... 阅读全文
posted @ 2015-12-24 14:15 0giant 阅读(162) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->... 阅读全文
posted @ 2015-12-24 10:55 0giant 阅读(243) 评论(0) 推荐(0) 编辑
摘要:Given two binary strings, return their sum (also a binary string).For example, a = "11" b = "1" Return "100". Subscribe to see which companies asked t... 阅读全文
posted @ 2015-12-22 16:58 0giant 阅读(159) 评论(0) 推荐(0) 编辑
摘要:Given a singly linked list, determine if it is a palindrome.Follow up: Could you do it in O(n) time and O(1) space?Subscribe to see which companies as... 阅读全文
posted @ 2015-12-22 16:54 0giant 阅读(282) 评论(0) 推荐(0) 编辑
摘要:You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time... 阅读全文
posted @ 2015-12-21 17:21 0giant 阅读(207) 评论(0) 推荐(0) 编辑
摘要:Write a function to find the longest common prefix string amongst an array of strings.这个题目和count and say比较类似了。就是把单独处理字符串的函数写出来,然后一个循环来实现最终功能就行了。这道题,就是... 阅读全文
posted @ 2015-12-20 16:01 0giant 阅读(227) 评论(0) 推荐(0) 编辑
摘要:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11.11 is read off... 阅读全文
posted @ 2015-12-18 21:38 0giant 阅读(176) 评论(0) 推荐(0) 编辑
摘要:Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --... 阅读全文
posted @ 2015-12-17 09:50 0giant 阅读(173) 评论(0) 推荐(0) 编辑
摘要:Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter... 阅读全文
posted @ 2015-12-16 11:13 0giant 阅读(143) 评论(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 occurrences... 阅读全文
posted @ 2015-12-16 10:37 0giant 阅读(170) 评论(0) 推荐(0) 编辑
摘要:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the c... 阅读全文
posted @ 2015-12-15 11:14 0giant 阅读(151) 评论(0) 推荐(0) 编辑
摘要:Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After ... 阅读全文
posted @ 2015-12-15 09:20 0giant 阅读(171) 评论(0) 推荐(0) 编辑
摘要: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 ... 阅读全文
posted @ 2015-12-14 20:45 0giant 阅读(175) 评论(0) 推荐(0) 编辑
摘要: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 sh... 阅读全文
posted @ 2015-12-13 21:56 0giant 阅读(242) 评论(0) 推荐(0) 编辑
摘要:Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word ... 阅读全文
posted @ 2015-12-11 09:19 0giant 阅读(136) 评论(0) 推荐(0) 编辑
摘要:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with... 阅读全文
posted @ 2015-12-10 20:32 0giant 阅读(159) 评论(0) 推荐(0) 编辑
摘要:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return... 阅读全文
posted @ 2015-12-10 08:34 0giant 阅读(183) 评论(0) 推荐(0) 编辑
摘要:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size tha... 阅读全文
posted @ 2015-12-09 18:12 0giant 阅读(165) 评论(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 le... 阅读全文
posted @ 2015-12-09 14:52 0giant 阅读(187) 评论(0) 推荐(0) 编辑
摘要:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a... 阅读全文
posted @ 2015-12-08 11:36 0giant 阅读(156) 评论(0) 推荐(0) 编辑
摘要:Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Subscribeto see which companies asked this question蛮简... 阅读全文
posted @ 2015-12-08 11:18 0giant 阅读(232) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo... 阅读全文
posted @ 2015-12-07 11:30 0giant 阅读(236) 评论(0) 推荐(0) 编辑
摘要: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()... 阅读全文
posted @ 2015-12-05 22:05 0giant 阅读(162) 评论(0) 推荐(0) 编辑
摘要:Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3, Return [1,3,3,1]. Note: Could you optimize your algorithm to u... 阅读全文
posted @ 2015-12-03 17:15 0giant 阅读(159) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示