上一页 1 ··· 22 23 24 25 26
摘要: 当 arr 是一个array时,写Java开始的corner case常常会写类似下面的语句:if(arr == null || arr.length == 0){ return 0;}其实这是两个条件, arr==null 和 arr.length==0 是不同的:arr.length ==... 阅读全文
posted @ 2015-08-17 01:33 Dylan_Java_NYC 阅读(460) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/add-digits/ 题目: Given a non-negative integer num, repeatedly add all its digits until the result has only one di 阅读全文
posted @ 2015-08-17 01:13 Dylan_Java_NYC 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/divide-two-integers/ 题目: Divide two integers without using multiplication, division and mod operator. If it is o 阅读全文
posted @ 2015-08-17 00:22 Dylan_Java_NYC 阅读(366) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里: https://leetcode.com/problems/add-binary/ 题目: Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"R 阅读全文
posted @ 2015-08-15 09:36 Dylan_Java_NYC 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/power-of-two/ 题目: Given an integer, write a function to determine if it is a power of two. 题解: bit manipulation, 阅读全文
posted @ 2015-08-15 08:39 Dylan_Java_NYC 阅读(358) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/rectangle-area/ 题目: Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is d 阅读全文
posted @ 2015-08-15 07:56 Dylan_Java_NYC 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/factorial-trailing-zeroes/ 题目: Given an integer n, return the number of trailing zeroes in n!. Example 1: Exampl 阅读全文
posted @ 2015-08-14 12:24 Dylan_Java_NYC 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/integer-to-roman/ 题目: Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. For exa 阅读全文
posted @ 2015-08-14 11:39 Dylan_Java_NYC 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/roman-to-integer/ 题目: Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. For exa 阅读全文
posted @ 2015-08-14 04:02 Dylan_Java_NYC 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/excel-sheet-column-number/ 题目: Given a column title as appear in an Excel sheet, return its corresponding column 阅读全文
posted @ 2015-08-14 00:37 Dylan_Java_NYC 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里: https://leetcode.com/problems/excel-sheet-column-title/ 题目: Given a positive integer, return its corresponding column title as appear in an E 阅读全文
posted @ 2015-08-14 00:20 Dylan_Java_NYC 阅读(319) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里: https://leetcode.com/problems/minimum-window-substring/ 题目: Given a string S and a string T, find the minimum window in S which will contain 阅读全文
posted @ 2015-08-13 04:51 Dylan_Java_NYC 阅读(700) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里: https://leetcode.com/problems/substring-with-concatenation-of-all-words/description/ 题目: ou are given a string s and an array of strings word 阅读全文
posted @ 2015-08-12 10:14 Dylan_Java_NYC 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/longest-substring-without-repeating-characters/ 题目: Given a string, find the length of the longest substring wit 阅读全文
posted @ 2015-08-08 10:30 Dylan_Java_NYC 阅读(420) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/single-number/ 题目: Given an array of integers, every element appears twice except for one. Find that single one. 阅读全文
posted @ 2015-08-06 08:58 Dylan_Java_NYC 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/single-number-ii/ 题目: Given a non-empty array of integers, every element appears three times except for one, whi 阅读全文
posted @ 2015-08-06 08:31 Dylan_Java_NYC 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/3sum-closest/ 题目: Given an array S of n integers, find three integers in S such that the sum is closest to a giv 阅读全文
posted @ 2015-08-06 02:44 Dylan_Java_NYC 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/4sum/ 题目: Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = targe 阅读全文
posted @ 2015-08-05 05:41 Dylan_Java_NYC 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/3sum/ 题目: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all uniq 阅读全文
posted @ 2015-08-05 04:42 Dylan_Java_NYC 阅读(334) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/fraction-to-recurring-decimal/ 题目: Given two integers representing the numerator and denominator of a fraction, 阅读全文
posted @ 2015-08-04 04:51 Dylan_Java_NYC 阅读(380) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/anagrams/ Given an array of strings, group anagrams together. For example, given: ["eat", "tea", "tan", "ate", " 阅读全文
posted @ 2015-08-03 12:09 Dylan_Java_NYC 阅读(303) 评论(0) 推荐(0) 编辑
摘要: Basically, they are just two different implementations of List interface.LinkedList is implemented with a double-linked list; ArrayList is implemented... 阅读全文
posted @ 2015-08-03 11:32 Dylan_Java_NYC 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/valid-anagram/ 题目: Given two strings s and t, write a function to determine if t is an anagram of s. For example 阅读全文
posted @ 2015-08-03 10:48 Dylan_Java_NYC 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/count-primes/ 题目: Given an integer n, return the number of prime numbers that are strictly less than n. Example 阅读全文
posted @ 2015-08-03 02:57 Dylan_Java_NYC 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 1. Class Variable/Static Variable: Class variable is also known as static variable with "static" keyword inside the class but outside the methods. The 阅读全文
posted @ 2015-07-24 22:36 Dylan_Java_NYC 阅读(547) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/happy-number/ 题目: Write an algorithm to determine if a number is "happy". A happy number is a number defined by 阅读全文
posted @ 2015-07-23 06:38 Dylan_Java_NYC 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 原题链接在此: https://leetcode.com/problems/isomorphic-strings/ 题目: Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic 阅读全文
posted @ 2015-07-23 04:41 Dylan_Java_NYC 阅读(259) 评论(0) 推荐(0) 编辑
摘要: 原题链接在此:https://leetcode.com/problems/sudoku-solver/ 题目: Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must sa 阅读全文
posted @ 2015-07-22 09:12 Dylan_Java_NYC 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 原题链接在此:https://leetcode.com/problems/n-queens/ 题目: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens 阅读全文
posted @ 2015-07-22 05:09 Dylan_Java_NYC 阅读(751) 评论(0) 推荐(0) 编辑
摘要: Final is a Keyword, final can be used in three different ways: final variable final method final class final variable 基本上就是 constant,一旦被赋值,就不能被变更;如果在c 阅读全文
posted @ 2015-07-22 03:24 Dylan_Java_NYC 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/valid-sudoku/ 题目: Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according 阅读全文
posted @ 2015-07-21 23:45 Dylan_Java_NYC 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 原题链接在这里:https://leetcode.com/problems/contains-duplicate-ii/ 题目: Given an array of integers and an integer k, find out whether there are two distinct 阅读全文
posted @ 2015-07-20 10:54 Dylan_Java_NYC 阅读(269) 评论(0) 推荐(0) 编辑
上一页 1 ··· 22 23 24 25 26