随笔分类 -  LeetCode

上一页 1 ··· 3 4 5 6 7
摘要:We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1. Now, given an integer arra 阅读全文
posted @ 2018-10-23 09:23 A-Little-Nut 阅读(127) 评论(0) 推荐(0)
摘要: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. Example: 阅读全文
posted @ 2018-10-23 09:19 A-Little-Nut 阅读(96) 评论(0) 推荐(0)
摘要:Given an array nums and a value val, remove all instances of that value in place and return the new length. Do not allocate extra space for another ar 阅读全文
posted @ 2018-10-23 09:17 A-Little-Nut 阅读(125) 评论(0) 推荐(0)
摘要:Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is po 阅读全文
posted @ 2018-02-10 16:35 A-Little-Nut 阅读(136) 评论(0) 推荐(0)
摘要:In LeetCode Store, there are some kinds of items to sell. Each item has a price. However, there are some special offers, and a special offer consists 阅读全文
posted @ 2018-02-10 16:34 A-Little-Nut 阅读(202) 评论(0) 推荐(0)
摘要:Initially on a notepad only one character 'A' is present. You can perform two operations on this notepad for each step: Copy All : You can copy all th 阅读全文
posted @ 2018-02-10 16:33 A-Little-Nut 阅读(257) 评论(0) 推荐(0)
摘要:Given an array of scores that are non negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and t 阅读全文
posted @ 2018-02-10 16:32 A-Little-Nut 阅读(99) 评论(0) 推荐(0)
摘要:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum pro 阅读全文
posted @ 2018-02-10 16:31 A-Little-Nut 阅读(107) 评论(0) 推荐(0)
摘要:Given a non negative integer n, count all numbers with unique digits, x, where 0 ≤ x Given n = 2, return 91. (The answer should be the total numbers i 阅读全文
posted @ 2018-02-10 16:31 A-Little-Nut 阅读(119) 评论(0) 推荐(0)
摘要:You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. Now, we define a pair (c, d) can follow an 阅读全文
posted @ 2018-02-10 16:30 A-Little-Nut 阅读(131) 评论(0) 推荐(0)
摘要:Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal. Example 1: Input: s1 = "sea", s2 = "eat" Output: 阅读全文
posted @ 2018-02-10 16:29 A-Little-Nut 阅读(290) 评论(0) 推荐(0)
摘要:A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the 阅读全文
posted @ 2018-02-10 16:27 A-Little-Nut 阅读(156) 评论(0) 推荐(0)
摘要:Given a string, your task is to count how many palindromic substrings in this string. The substrings with different start indexes or end indexes are c 阅读全文
posted @ 2018-02-10 16:01 A-Little-Nut 阅读(120) 评论(0) 推荐(0)
摘要:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and r 阅读全文
posted @ 2018-01-21 10:07 A-Little-Nut 阅读(172) 评论(0) 推荐(0)
摘要:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo 阅读全文
posted @ 2018-01-21 09:04 A-Little-Nut 阅读(155) 评论(0) 推荐(0)
摘要:Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Note: 1: You may assume that the array 阅读全文
posted @ 2018-01-20 21:37 A-Little-Nut 阅读(143) 评论(0) 推荐(0)
摘要:On a staircase, the i th step has some non negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. Y 阅读全文
posted @ 2018-01-20 21:15 A-Little-Nut 阅读(181) 评论(0) 推荐(0)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文
posted @ 2018-01-20 20:50 A-Little-Nut 阅读(375) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-01-20 20:44 A-Little-Nut 阅读(157) 评论(0) 推荐(0)
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [ 2,1, 3,4, 1,2, 阅读全文
posted @ 2018-01-20 20:36 A-Little-Nut 阅读(178) 评论(0) 推荐(0)

上一页 1 ··· 3 4 5 6 7