摘要:
题目链接Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word... 阅读全文
摘要:
题目链接The set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence... 阅读全文
摘要:
Jump Game Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Dete... 阅读全文
摘要:
题目链接Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were ini... 阅读全文
摘要:
题目链接Given a collection of intervals, merge all overlapping intervals.For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18].对若干... 阅读全文
摘要:
题目链接 Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,−1,2,1,−5,4], the contiguous subarray [4,−1,2... 阅读全文
摘要:
How do you know what machine learning algorithm to choose for your classification problem? Of course, if you really care about accuracy, your best bet... 阅读全文
摘要:
Unique PathsA robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right a... 阅读全文
摘要:
题目链接Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3->NULL.首... 阅读全文
摘要:
题目链接Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see bel... 阅读全文
摘要:
Search Insert PositionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if ... 阅读全文
摘要:
题目链接Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.For example:Input: ["tea","and","... 阅读全文
摘要:
题目链接Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are th... 阅读全文
摘要:
题目链接Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique lo... 阅读全文
摘要:
题目链接There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should... 阅读全文
摘要:
题目链接Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.合并k个有序的链表,我们假设每个链表的平均长度是n。这一题需要用到合并两个有序的链表子过程算法1... 阅读全文
摘要:
题目链接Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.1为了操作... 阅读全文
摘要:
题目链接Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. Afte... 阅读全文
摘要:
这里不详细说明快速排序的原理,具体可参考here快速排序主要是partition的过程,partition最常用有以下两种写法第一种: int mypartition(vector&arr, int low, int high) { int pivot = arr[low];//选第一个元素... 阅读全文
摘要:
PermutationsGiven a collection of numbers, return all possible permutations.For example, [1,2,3] have the following permutations: [1,2,3], [1,3,2]... 阅读全文
摘要:
3Sum ClosestGiven an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution.For example, given array S = {-1 2 1 -4}, and target = 1. The sum that is clo... 阅读全文
摘要:
题目链接Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the tw... 阅读全文