- 博客(10)
- 收藏
- 关注
原创 Valid Anagram
题目如下: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”, t = “car”, return false.思路如下:先判断
2015-08-11 10:25:26 260
原创 Search Insert Position
Given 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 it were inserted in order.You may assume no duplicates in the array.Here
2015-07-10 17:32:56 235
原创 Contains Duplicate
题目: 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 array, and it should return false if every elemen
2015-07-10 15:09:37 354
原创 Excel Sheet Column Number
题目如下: Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example:A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 2
2015-06-15 20:34:39 272
原创 Single Number II
Given an array of integers, every element appears three times except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it without using ex
2015-06-15 18:38:18 340
原创 3Sum
使用3层for循环暴力之public class Solution { public static List<List<Integer>> threeSum(int[] nums) { List<List<Integer>> countList = new ArrayList<List<Integer>>(); List<Integer> list = nul
2015-05-21 21:59:08 230
原创 leetcode Single Number 136
题目如下: Given an array of integers, every element appears twice except for one. Find that single one.(给一个整型数组,数组中的元素,除了一个是单独出现的,其他全部出现两次,请找出只出现一个次的元素)public class Solution { public static int singl
2015-05-13 11:43:20 332
原创 Majority Element leetcode[169]
题目如下: 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 the array is non-empty and the majority element
2015-05-04 20:26:05 256
原创 Length of Last Word (leetCode 58)
题目如下: Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string.If the last word does not exist, return 0.Note: A word is def
2015-05-04 17:42:33 369
原创 Two Sum leetcode第一题
Two SumGiven 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 two numbers such that they add up to the target, w
2015-04-27 12:04:42 316
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人