![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java-刷题
wynhuhu
这个作者很懒,什么都没留下…
展开
-
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 · 248 阅读 · 0 评论 -
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 -> 1B -> 2C -> 3...Z -> 26AA -> 27AB -> 2原创 2015-06-15 20:34:39 · 264 阅读 · 0 评论 -
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 · 331 阅读 · 0 评论 -
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 · 343 阅读 · 0 评论 -
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 · 224 阅读 · 0 评论 -
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 · 223 阅读 · 0 评论 -
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 · 323 阅读 · 0 评论 -
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 · 362 阅读 · 0 评论 -
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 · 309 阅读 · 0 评论 -
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 · 251 阅读 · 0 评论