Java
文章平均质量分 81
Moplast_Cat
这个作者很懒,什么都没留下…
展开
-
[2015/09/03] 快速幂算法 - 大数取余
做HDOJ的2035题时遇到了这个问题,估计是脑子比较笨,看了很多都不懂,后来终于找到了一个大神写的详细解释http://wenku.baidu.com/link?url=W3_uQ5Xi45_oeU56uZVUumrk7duKWoRXiGrOhQpx4B2SApiUIBgnUzsK-eytYD3Yq64IzJj3hERyZyhfv3DNBwmyXsVSBJKUWGVVf39gp7q转载 2015-09-03 01:12:31 · 670 阅读 · 0 评论 -
[2016/07/06] LeetCode / Java - Day 13 -
137. Single Number IIGiven 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 y原创 2016-07-06 13:28:29 · 486 阅读 · 0 评论 -
[2016/07/05] LeetCode / Java - Day 12 -
328. Odd Even Linked ListGiven a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes原创 2016-07-05 12:20:11 · 366 阅读 · 0 评论 -
[2016/07/03] LeetCode / Java - Day 11 -
12. Integer to RomanGiven an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.思路:这道题不难,就是真的,很。。。烦。。。而且需要补充几个规则:基本数字 Ⅰ、X 、C 中的任何一个、原创 2016-07-03 11:32:17 · 383 阅读 · 0 评论 -
[2016/07/02] LeetCode / Java - Day 10 -
318. Maximum Product of Word LengthsGiven a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that原创 2016-07-02 15:45:54 · 440 阅读 · 0 评论 -
[2016/07/01] LeetCode / Java - Day 09 -
下半年加油~不要问我为啥今天这么早→ →206. Reverse Linked ListReverse a singly linked list.思路:逆序链表,呃我一下子就想到了堆栈。。其实这个O(2n)的时间复杂度+O(n)的空间复杂度不太好的。。看了一下别人的程序,昨晚有点头昏,就没有仔细看,大概是循环,然后首尾交换,就是改next关系,而我是直接改的val。原创 2016-07-01 09:12:49 · 448 阅读 · 0 评论 -
[2016/06/30] LeetCode / Java - Day 08 -
时间过得真快呀~很快就第八天了,话说21天可以养成一个习惯,坚持(๑•̀ㅂ•́)و✧ 但是为什么我就不能好好坚持空中自行车→ →坚持天鹅臂呢→ →。。。为什么身为一个妹子我连每天坚持洗脸都做不到(……)却能坚持每天写代码……319. Bulb SwitcherThere are n bulbs that are initially off. You first turn o原创 2016-06-30 19:43:32 · 357 阅读 · 0 评论 -
[2016/06/29] LeetCode / Java - Day 07 -
217. Contains DuplicateGiven 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 retur原创 2016-06-29 20:18:54 · 436 阅读 · 0 评论 -
[2016/06/28] LeetCode / Java - Day 06 -
347. Top K Frequent ElementsGiven a non-empty array of integers, return the k most frequent elements.For example,Given [1,1,1,2,2,3] and k = 2, return [1,2].Note: You may assume原创 2016-06-28 17:26:22 · 358 阅读 · 0 评论 -
[2016/06/26] LeetCode / Java - Day 04 -
349. Intersection of Two ArraysGiven two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note:Each element原创 2016-06-27 20:32:53 · 326 阅读 · 0 评论 -
[2016/06/27] LeetCode / Java - Day 05 -
171. Excel Sheet Column NumberRelated to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A ->原创 2016-06-27 20:24:26 · 352 阅读 · 0 评论 -
[2016/06/25] LeetCode / Java - Day 3 -
260. Single Number IIIGiven an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only onc原创 2016-06-25 13:43:01 · 305 阅读 · 0 评论 -
[2016/06/24] LeetCode / Java - Day 02 -
258. Add DigitsGiven a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 +原创 2016-06-24 16:20:23 · 338 阅读 · 0 评论 -
[2016/02/27] PAT(Basic Level) Problem 1001-1050 JAVA略解
0 照例说闲话开学以来没做什么,除了刷了快50道Basic的算法题,就是复习三级偏硬和上课(上课还不听)。一周时间50题,感觉自己的算法并没有提高,虽然有总结和不断的看别人的好程序,但是感觉真正学到的并不多,很多是套路,还有很多是“卧槽我程序和他一样为啥我超时哦因为我是java”的自我安慰。以下的50道题并不是都AC了,甚至连绝大部分AC都算不上,但是网上查了一下没有PAT的java代码,原创 2016-02-27 10:48:28 · 1400 阅读 · 0 评论 -
[2016/03/09] 关于深搜的题目整理和思路 & 蓝桥杯历年试题 - 大臣的路费/颠倒的价牌
0 一些废话说废话已经是我的习惯了。那么关于深搜,老早就想整理了,这毕竟是小白我唯一会的算法嘛。同样,网上基本找不到Java的深搜样本,当然,那是因为算法不需要用java写。不过,作为总结和整理,我还是用java写一份吧=-=不过跟C也没什么区别。1 经典题目:走迷宫package Basic;import java.util.Scanner;/**深搜走迷宫算法原创 2016-03-09 22:05:41 · 1465 阅读 · 0 评论 -
[2016/03/14] 2015蓝桥杯省赛A组Java语言 真题略解
1. 结果填空 (满分3分)熊怪吃核桃 森林里有一只熊怪,很爱吃核桃。不过它有个习惯,每次都把找到的核桃分成相等的两份,吃掉一份,留一份。如果不能等分,熊怪就会扔掉一个核桃再分。第二天再继续这个过程,直到最后剩一个核桃了,直接丢掉。 有一天,熊怪发现了1543个核桃,请问,它在吃这些核桃的过程中,一共要丢掉多少个核桃。 请填写该数字(一个整数),不要填写任何多余的原创 2016-03-14 13:40:41 · 3785 阅读 · 0 评论 -
[2016/06/23] LeetCode OJ / Java
从今天开始撸LeetCode。嗯,AC率从高到低来刷。344. Reverse StringWrite a function that takes a string as input and returns the string reversed.Example:Given s = "hello", return "olleh".--------------原创 2016-06-23 17:36:01 · 374 阅读 · 0 评论