Java
styshoo
这个作者很懒,什么都没留下…
展开
-
【LeetCode】268 Missing Number (java实现)
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2.Note:Your algorithm should run原创 2015-08-29 12:28:01 · 1697 阅读 · 0 评论 -
【LeetCode】455. Assign Cookies (java实现)
原题链接https://leetcode.com/problems/assign-cookies/原题Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a g原创 2016-11-29 05:33:35 · 2014 阅读 · 0 评论 -
【LeetCode】409. Longest Palindrome (java实现)
原题链接https://leetcode.com/problems/longest-palindrome/原题Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.T原创 2016-11-13 07:26:35 · 1109 阅读 · 0 评论 -
【LeetCode】396. Rotate Function(java实现)
原题链接https://leetcode.com/problems/rotate-function/原题Given an array of integers A and let n to be its length. Assume Bk to be an array obtained by rotating the array A k positions clock-wise, we define原创 2016-11-18 06:06:05 · 908 阅读 · 0 评论 -
【LeetCode】461. Hamming Distance (java实现)
原题链接https://leetcode.com/problems/hamming-distance/原题The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calcu原创 2017-01-05 22:51:29 · 4995 阅读 · 0 评论 -
【LeetCode】475. Heaters (java实现)
原题链接https://leetcode.com/problems/heaters/原题Winter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses.Now, you are given positions原创 2016-12-28 23:07:53 · 3689 阅读 · 0 评论 -
【LeetCode】389 Find the Difference(java)
原题Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was added i原创 2016-09-29 23:46:25 · 1121 阅读 · 1 评论 -
【LeetCode】476. Number Complement (java实现)
原题链接https://leetcode.com/problems/number-complement/原题Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given int原创 2017-01-26 06:59:38 · 3033 阅读 · 1 评论 -
【LeetCode】387 First Unique Character in a String(java实现)
原题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.s = "loveleetcode",return 2.Note: You may assume t原创 2016-10-20 00:37:41 · 2638 阅读 · 0 评论 -
【LeetCode】404 Sum of Left Leaves(java实现)
原题Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24.题原创 2016-10-20 00:34:27 · 1919 阅读 · 0 评论 -
【LeetCode】405 Convert a Number to Hexadecimal (java实现)
原题链接https://leetcode.com/problems/convert-a-number-to-hexadecimal/原题Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.Note: 1. Al原创 2016-11-09 23:33:12 · 2372 阅读 · 0 评论 -
Eclipse中开启java的assert选项
在java中,assert开关是jvm的选项,默认是关闭的,开启选项的参数为-enableassertions或者其简写-ea。如果需要在eclipse调试时开启assert选项,需要对项目进行配置,这里介绍两种方法: 1.Run -> Run Configurations->Java Application-> Arguments页签 -> VM arguments文本框中加上断言开启的标志:原创 2015-09-04 15:34:36 · 4614 阅读 · 0 评论 -
【LeetCode】292 Nim Games (java实现)
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the原创 2015-12-08 00:04:48 · 991 阅读 · 0 评论 -
【LeetCode】299 Bulls and Cows (java实现)
原题题目要求常规解法更聪明的代码原题:You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess,原创 2016-04-16 11:01:24 · 2901 阅读 · 0 评论 -
【LeetCode】345 Reverse Vowels of a String(java)
原题题目要求解法原题Write a function that takes a string as input and reverse only the vowels of a string.Example 1: Given s = “hello”, return “holle”.Example 2: Given s = “leetcode”, return “leotcede”. 题目要原创 2016-05-04 16:15:30 · 3472 阅读 · 1 评论 -
【LeetCode】383 Ransom Note(java)
原题题目要求解法原题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原创 2016-08-17 17:35:30 · 6939 阅读 · 0 评论 -
【LeetCode】400 Nth Digit(java实现)
原题链接https://leetcode.com/problems/nth-digit/原题Find the nthn^th digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, …Note: n is positive and will fit within the range of a 32-bit原创 2016-10-24 07:15:21 · 1781 阅读 · 0 评论 -
【LeetCode】401 Binary Watch (java实现)
原题链接https://leetcode.com/problems/binary-watch/原题A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).Each LED represents a z原创 2016-10-24 07:17:12 · 3050 阅读 · 1 评论 -
【LeetCode】415 Add Strings (java实现)
原题链接https://leetcode.com/problems/add-strings/原题Given two non-negative numbers num1 and num2 represented as string, return the sum of num1 and num2.Note:The length of both num1 and num2 is < 5100.Both原创 2016-10-28 07:08:48 · 4870 阅读 · 2 评论 -
maven单元测试设置代理
背景 环境需要设置代理才能够访问外部网络,如果只是运行java程序来访问网络,我们可以通过java -jar test.jar -DproxyHost=proxy_ip -DproxyPort=proxy_port,但如果是java的maven项目中,单元测试需要访问网络,只执行mvn test则会导致单元测试的代码无法访问网络。 解决 Maven单元测试,使用的是Surefire Maven原创 2017-08-02 07:41:30 · 860 阅读 · 0 评论