这题不难,核心是找零问题,首先看下题目: At a lemonade stand, each lemonade costs $5. Customers are standing in a queue ...
我又回来了,继续刷算法,可能的话,英文也想加强一下。由于好久没有刷了,先把新增的几个easy级别题目做了。首先看下面这题: Given two strings A and B of lowercase...
这题没有做过类似的,所以感觉还是有点难度的,先来看下题目: A sequence of numbers is called a wiggle sequence if the differences b...
Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of ...
The thief has found himself a new place for his thievery again. There is only one entrance to this a...
Given n, how many structurally unique BST’s (binary search trees) that store values 1 …...
Given an integer n, generate all structurally unique BST’s (binary search trees) that store va...
这题挺有意思,主要是要找出是否有3个元素递增,这3个元素的索引必须依次增加但是不要求临近。首先贴题目: Given an unsorted array return whether an increa...
这题的follow up实在太难,没想出来,就贴一个简单的做法。首先先贴一下题目: Given an unsorted array nums , reorder it such that nums[0...
这题我做的时候用了动态规划,但是也只是能满足时间复杂度小于O(N2),先看下题目 Given an unsorted array of integers, find the length of lon...