You are playing the following Bulls and Cows game with your friend: You write down a number and ask ...
又是一道single number题目,这类题目一般都是依赖位操作,先给出题目: Given an array of numbers nums , in which exactly two eleme...
一道初看上去有点儿难度的题目,其实想明白了也不算太难。首先上题目: Given a string of numbers and operators, return all possible resul...
先看题目: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand....
这题和Maximum subarray很相似,一看到就想到是一个DP问题,首先给出题目: Given an integer array nums , find the contiguous subar...
一道在链表上进行插入排序的题目,假设在数组上,插入排序的写法不难,但是数据结构改为链表,还是有点儿麻烦的。首先看下题目: Sort a linked list using insertion sort...
又是一道动态规划的题目,当然个人感觉不那么明显,但是也有递推的逻辑存在。 Given a non-empty string s and a dictionary wordDict containing...
一道比较复杂的二叉树类题目,先给出题目: Given preorder and inorder traversal of a tree, construct the binary tree. Note...
这是一道排列的问题。在编程里,为了完成排列,基本上是由一个升序的数组,然后通过N次排列,生成N个中间排列结果,直到排列为倒序的数组,这样就会有N+2个排列方式。先看题目: Implement ```n...
首先给出题目,这两题都是感觉有点儿复杂,但是道理是相通的题目。 3Sum Given an array nums of n integers, are there elements a, b, c i...