摘要:
Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endp 阅读全文
摘要:
5. Longest Palindromic Substring Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. E 阅读全文
摘要:
#Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive #integer targe 阅读全文
摘要:
#Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies:#Si % Sj = 0 or 阅读全文
摘要:
#Say you have an array for which the ith element is the price of a given stock on day i.#Design an algorithm to find the maximum profit. You may compl 阅读全文
摘要:
#Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n.#Example 1:#Input: n = 12# 阅读全文
摘要:
def BubbleSort(lst): for i in range(len(lst)-1): for j in range(len(lst)-1-i): if lst[j]>lst[j+1]: lst[j],lst[j+1] = lst[j+1],lst[j] return lst 首先,不知道 阅读全文
摘要:
leetcode例题: 216. Combination Sum III Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be 阅读全文