Lemonade Change

作者:sryan 更新时间:2020-04-03 17:29 分类:数据结构与算法

这题不难,核心是找零问题,首先看下题目: At a lemonade stand, each lemonade costs $5. Customers are standing in a queue ...

点击数:453 回复数:0

Buddy Strings

作者:sryan 更新时间:2020-04-03 16:38 分类:数据结构与算法

我又回来了,继续刷算法,可能的话,英文也想加强一下。由于好久没有刷了,先把新增的几个easy级别题目做了。首先看下面这题: Given two strings A and B of lowercase...

点击数:501 回复数:0

wiggle sequence

作者:sryan 更新时间:2019-05-29 11:40 分类:数据结构与算法

这题没有做过类似的,所以感觉还是有点难度的,先来看下题目: A sequence of numbers is called a wiggle sequence if the differences b...

点击数:613 回复数:0

Largest Divisible Subset

作者:sryan 更新时间:2019-04-17 17:34 分类:数据结构与算法

Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of ...

点击数:910 回复数:0

House Robber III

作者:sryan 更新时间:2019-04-10 11:53 分类:数据结构与算法

The thief has found himself a new place for his thievery again. There is only one entrance to this a...

点击数:732 回复数:0

Unique Binary Search Trees

作者:sryan 更新时间:2019-04-09 17:17 分类:数据结构与算法

Given n, how many structurally unique BST’s (binary search trees) that store values 1 …...

点击数:745 回复数:0

Unique Binary Search Trees II

作者:sryan 更新时间:2019-04-08 17:20 分类:数据结构与算法

Given an integer n, generate all structurally unique BST’s (binary search trees) that store va...

点击数:691 回复数:0

Increasing Triplet Subsequence

作者:sryan 更新时间:2018-07-23 14:49 分类:数据结构与算法

这题挺有意思,主要是要找出是否有3个元素递增,这3个元素的索引必须依次增加但是不要求临近。首先贴题目: Given an unsorted array return whether an increa...

点击数:942 回复数:0

Wiggle Sort II

作者:sryan 更新时间:2018-07-23 11:11 分类:数据结构与算法

这题的follow up实在太难,没想出来,就贴一个简单的做法。首先先贴一下题目: Given an unsorted array nums , reorder it such that nums[0...

点击数:935 回复数:0

Longest Increasing Subsequence

作者:sryan 更新时间:2018-07-19 11:02 分类:数据结构与算法

这题我做的时候用了动态规划,但是也只是能满足时间复杂度小于O(N2),先看下题目 Given an unsorted array of integers, find the length of lon...

点击数:875 回复数:0