
Java
文章平均质量分 86
Matcha_ee
这个作者很懒,什么都没留下…
展开
-
LeetCode - 383. Ransom Note
题目:Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magaz原创 2017-02-16 22:24:38 · 351 阅读 · 0 评论 -
LeetCode - 242. 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.Note:You ma原创 2017-03-02 15:55:46 · 463 阅读 · 0 评论 -
LeetCode - 189. Rotate Array
题目: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]. Note:Try to come up as many solutions as原创 2017-02-22 17:52:27 · 245 阅读 · 0 评论 -
leetCode - 459. Repeated Substring Pattern
题目:Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase原创 2017-02-21 20:40:46 · 358 阅读 · 0 评论 -
LeetCode - 520. Detect Capital
题目:Given a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be right when one of the following cases holds:All letters原创 2017-02-21 17:56:23 · 381 阅读 · 0 评论 -
LeetCode - 434. Number of Segments in a String
题目:Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.Please note that the string does not contain any non-printable charact原创 2017-02-21 12:55:28 · 390 阅读 · 0 评论 -
LeetCode - 125. Valid Palindrome
题目:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.思路与步骤:首先理解题目要求:通过测试样例得知,输入的字符串只比较大小写字母和0-9,其中同一个字母的大小写认为一样,其他字忽略。于是有两种思路思路1:原创 2017-02-20 22:13:56 · 383 阅读 · 0 评论 -
LeetCode - 67. Add Binary
题目:Given two binary strings, return their sum (also a binary string).思路与步骤:原思路:将两个string逐个字符相加,设置一个flag ,进位的话记 flag=1,反之 flag=0需要处理的一些细节:1. a 和 b 的 0, 1 是字符形式,要写成 '0', '1';flag 是 int 型原创 2017-02-20 13:23:21 · 248 阅读 · 0 评论 -
LeetCode - 28. Implement strStr()
题目:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.思路与步骤:两个字符串逐个字符比较,如果两个字符串第一个不同,则大的下标加1,小的不变,依次循环;如果相同,则依次逐个比较原创 2017-02-19 22:19:55 · 261 阅读 · 0 评论 -
LeetCode - 20. Valid Parentheses
题目:Given a string containing just the characters '(', ')','{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all原创 2017-02-19 20:07:28 · 238 阅读 · 0 评论 -
LeetCode - 13. Roman to Integer
题目:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.思路与步骤:分两步进行,先对应,再计算。基本思路是: 首先将 roman 基本字符与阿拉伯数字对应起来,存在一个结构中,然后对输入的字符串逐个字原创 2017-02-19 15:24:04 · 414 阅读 · 0 评论 -
leetCode - 496. Next Greater Element I
题目:You are given two arrays (without duplicates) nums1 andnums2 where nums1’s elements are subset of nums2. Find all the next greater numbers fornums1's elements in the corresponding places of原创 2017-02-28 11:52:50 · 490 阅读 · 0 评论 -
LeetCode - 350. Intersection of Two Arrays II
题目:Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return[2, 2].Note:Each element in the result should appear as原创 2017-02-27 21:32:43 · 358 阅读 · 0 评论 -
LeetCode - 345. Reverse Vowels of a String
题目:Write a function that takes a string as input and reverse only the vowels of a string.思路与步骤:1. 找出源字符串中的元音字母;2. 为了只遍历一次,需要每次都找出当前的第一个和最后一个元音字母,并进行交换。步骤:1. 写一个方法来判断是否是元音字母;2. 当字符串为空原创 2017-02-03 23:14:10 · 334 阅读 · 0 评论