随笔分类 -  Leetcode

摘要:Validate if a given string can be interpreted as a decimal number. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => true" 阅读全文
posted @ 2018-10-21 19:27 Veritas_des_Liberty 阅读(187) 评论(0) 推荐(0) 编辑
摘要: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. 阅读全文
posted @ 2018-10-21 13:58 Veritas_des_Liberty 阅读(156) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-10-21 13:40 Veritas_des_Liberty 阅读(171) 评论(0) 推荐(0) 编辑
摘要:Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1: Input: 1->2->3->4->5->NULL, k = 2 Output: 4->5->1-> 阅读全文
posted @ 2018-10-20 21:36 Veritas_des_Liberty 阅读(179) 评论(0) 推荐(0) 编辑
摘要: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 seque 阅读全文
posted @ 2018-10-20 10:35 Veritas_des_Liberty 阅读(147) 评论(0) 推荐(0) 编辑
摘要:Given a positive integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. Example: AC code: Runtime: 0 ms, faster than 1 阅读全文
posted @ 2018-10-19 21:04 Veritas_des_Liberty 阅读(158) 评论(0) 推荐(0) 编辑
摘要:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initia 阅读全文
posted @ 2018-10-19 20:36 Veritas_des_Liberty 阅读(155) 评论(0) 推荐(0) 编辑
摘要:Given a collection of intervals, merge all overlapping intervals. Example 1: Example 2: AC code: 阅读全文
posted @ 2018-10-19 20:27 Veritas_des_Liberty 阅读(157) 评论(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 @ 2018-10-19 16:00 Veritas_des_Liberty 阅读(128) 评论(0) 推荐(0) 编辑
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim 阅读全文
posted @ 2018-10-19 09:40 Veritas_des_Liberty 阅读(150) 评论(0) 推荐(0) 编辑
摘要:Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Inpu 阅读全文
posted @ 2018-10-18 22:33 Veritas_des_Liberty 阅读(171) 评论(0) 推荐(0) 编辑
摘要:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return the 阅读全文
posted @ 2018-10-18 22:16 Veritas_des_Liberty 阅读(170) 评论(0) 推荐(0) 编辑
摘要:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all 阅读全文
posted @ 2018-10-18 22:11 Veritas_des_Liberty 阅读(146) 评论(0) 推荐(0) 编辑
摘要:Implement pow(x, n), which calculates x raised to the power n (xn). Example 1: Example 2: Example 3: Note: -100.0 < x < 100.0 n is a 32-bit signed int 阅读全文
posted @ 2018-10-17 22:00 Veritas_des_Liberty 阅读(223) 评论(0) 推荐(0) 编辑
摘要:Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["nat", 阅读全文
posted @ 2018-10-17 21:38 Veritas_des_Liberty 阅读(160) 评论(0) 推荐(0) 编辑
摘要:You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note: You have to rotate the image in-place, which 阅读全文
posted @ 2018-10-17 20:01 Veritas_des_Liberty 阅读(177) 评论(0) 推荐(0) 编辑
摘要:Given a collection of numbers that might contain duplicates, return all possible unique permutations. Example: AC code: Runtime: 28 ms, faster than 46 阅读全文
posted @ 2018-10-17 19:46 Veritas_des_Liberty 阅读(185) 评论(0) 推荐(0) 编辑
摘要:Given a collection of distinct integers, return all possible permutations. Example: Input: [1,2,3] Output: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1, 阅读全文
posted @ 2018-10-17 11:50 Veritas_des_Liberty 阅读(179) 评论(0) 推荐(0) 编辑
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maxim 阅读全文
posted @ 2018-10-17 11:17 Veritas_des_Liberty 阅读(171) 评论(0) 推荐(0) 编辑
摘要:Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. '*' M 阅读全文
posted @ 2018-10-16 20:37 Veritas_des_Liberty 阅读(171) 评论(0) 推荐(0) 编辑