两个数组的交集 II
摘要:Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2,2] Example 2: Input: n
阅读全文
字符串中的第一个唯一字符
摘要:Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. Examples: s = "leetcode" return 0.
阅读全文
两个列表的最小索引总和
摘要:Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings. You need to h
阅读全文
两数之和
摘要: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 ex
阅读全文
两个数组的交集
摘要:Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2] Example 2: Input: num
阅读全文
只出现一次的数字
摘要:Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runti
阅读全文
存在重复元素
摘要: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 arr
阅读全文