Bulls and Cows

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

You are playing the following Bulls and Cows game with your friend: You write down a number and ask ...

点击数:889 回复数:0

Single Number III

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

又是一道single number题目,这类题目一般都是依赖位操作,先给出题目: Given an array of numbers nums , in which exactly two eleme...

点击数:766 回复数:0

Different Ways to Add Parentheses

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

一道初看上去有点儿难度的题目,其实想明白了也不算太难。首先上题目: Given a string of numbers and operators, return all possible resul...

点击数:812 回复数:0

Find Minimum in Rotated Sorted Array

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

先看题目: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand....

点击数:761 回复数:0

Maximum Product Subarray

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

这题和Maximum subarray很相似,一看到就想到是一个DP问题,首先给出题目: Given an integer array nums , find the contiguous subar...

点击数:827 回复数:0

Insertion Sort List

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

一道在链表上进行插入排序的题目,假设在数组上,插入排序的写法不难,但是数据结构改为链表,还是有点儿麻烦的。首先看下题目: Sort a linked list using insertion sort...

点击数:854 回复数:0

Word Break

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

又是一道动态规划的题目,当然个人感觉不那么明显,但是也有递推的逻辑存在。 Given a non-empty string s and a dictionary wordDict containing...

点击数:783 回复数:0

Construct Binary Tree from Preorder and Inorder Traversal

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

一道比较复杂的二叉树类题目,先给出题目: Given preorder and inorder traversal of a tree, construct the binary tree. Note...

点击数:761 回复数:0

Next permutation

作者:sryan 更新时间:2018-06-22 12:06 分类:数据结构与算法

这是一道排列的问题。在编程里,为了完成排列,基本上是由一个升序的数组,然后通过N次排列,生成N个中间排列结果,直到排列为倒序的数组,这样就会有N+2个排列方式。先看题目: Implement ```n...

点击数:782 回复数:0

3Sum&&3Sum Closest

作者:sryan 更新时间:2018-06-21 16:54 分类:数据结构与算法

首先给出题目,这两题都是感觉有点儿复杂,但是道理是相通的题目。 3Sum Given an array nums of n integers, are there elements a, b, c i...

点击数:775 回复数:0