随笔分类 - leetcode
摘要: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
阅读全文
摘要:I: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the following matrix: Yo
阅读全文
摘要:The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order,We get the following sequence
阅读全文
摘要:Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given1->2->3->4->5->NULLand k =2,return4->5->1->2->3->NUL
阅读全文
摘要:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any p
阅读全文
摘要:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
阅读全文
摘要:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 合并两个有序链表
阅读全文
摘要:Given two binary strings, return their sum (also a binary string). For example,a ="11"b ="1"Return"100".
阅读全文
摘要:Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => true Note: It is intended for the
阅读全文
摘要:Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is a
阅读全文
摘要:Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You shou
阅读全文
摘要:Implementint sqrt(int x). Compute and return the square root of x. 逐次逼近
阅读全文
摘要:You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl
阅读全文
摘要:题目描述 Given an absolute path for a file (Unix-style), simplify it. For example,path ="/home/", =>"/home"path ="/a/./b/../../c/", =>"/c" click to show c
阅读全文
摘要:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have
阅读全文
摘要:题目描述 Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. click to show follow up. Follow up: Did you use ext
阅读全文
摘要:题目描述 Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sor
阅读全文
摘要:题目描述 Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order
阅读全文
摘要:题目描述 Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n). For example,S ="ADOB
阅读全文
摘要:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example,If n = 4 and k = 2, a solution is: 要求 给定两个整数(n,k
阅读全文

浙公网安备 33010602011771号