摘要:
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... 阅读全文
摘要:
Write a function to find the longest common prefix string amongst an array of strings.这个题目和count and say比较类似了。就是把单独处理字符串的函数写出来,然后一个循环来实现最终功能就行了。这道题,就是... 阅读全文
摘要:
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... 阅读全文
摘要:
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 --... 阅读全文
摘要:
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... 阅读全文
摘要:
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... 阅读全文
摘要:
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the c... 阅读全文
摘要:
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 ... 阅读全文
摘要:
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 ... 阅读全文
摘要:
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... 阅读全文
摘要:
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 ... 阅读全文
摘要:
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... 阅读全文
摘要:
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return... 阅读全文
摘要:
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... 阅读全文
摘要:
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... 阅读全文