摘要:题目: Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = "rat",
阅读全文
摘要:题目: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a l
阅读全文
摘要:题目: Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2]. 相比较I,这个题目允许答案
阅读全文
摘要:题目: Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtime com
阅读全文
摘要:题目: Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. 第一次做的时候先将nums1存储
阅读全文
摘要:题目:Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurr
阅读全文
摘要:题目: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the
阅读全文
摘要:题目: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a sin
阅读全文
摘要:题目: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array
阅读全文
摘要:题目:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three intege
阅读全文
摘要:题目: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum
阅读全文
摘要:题目: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two e
阅读全文
摘要:题目: Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed? Would this affect the run-time complexity? How and why? Write a fun
阅读全文
摘要:题目: Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). You are given a targe
阅读全文
摘要:题目: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the
阅读全文
摘要:题目: Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transac
阅读全文
摘要:题目: Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example,
阅读全文
摘要:题目: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. 思路大概是一步一步从后往前算出每行的各个元素。
阅读全文
摘要:题目: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra spac
阅读全文
摘要:题目: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].
阅读全文
摘要:题目:Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have
阅读全文
摘要:题目:Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, y
阅读全文
摘要:题目:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that
阅读全文
摘要:题目:Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit i
阅读全文
摘要:题目:Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and t
阅读全文