- 博客(34)
- 资源 (16)
- 收藏
- 关注
原创 LeetCode 平衡二叉树
https://leetcode-cn.com/problems/balanced-binary-tree/description/我的解决方案:/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode ...
2018-08-30 23:54:35 369
原创 LeetCode 将有序数组转换为二叉搜索树
https://leetcode-cn.com/problems/convert-sorted-array-to-binary-search-tree/description/我的解决方案:其实我也想到了是递归,但是一直没有找到循环体应该是什么样子的,后来搜索了一下BST,又根据题目中高度平衡这一关键字的点醒,逐渐找到了正确的思路public class Solution { pu...
2018-08-29 23:48:55 363
原创 LeetCode 二叉树的层次遍历
https://leetcode-cn.com/problems/binary-tree-level-order-traversal-ii/description/我的解决方案: 我的思路是把二叉树按照层次转换成列表,然后统计每一层有多少个节点,按照层次存储城数组形式,之后按照每层的节点个数对列表进行划分,将结果反转之后返回class Solution { public int...
2018-08-27 19:19:48 456 2
原创 LeetCode 二叉树的最大深度
https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/description/我的解决方案:/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * T...
2018-08-27 14:13:10 243
原创 WeChall Training: Crypto - Transposition I
其实这道题目挺水的,但是我却掉到坑里去了,我开始还在想这是怎么加密,后来越看越感觉这些字母好像能组成我认识的单词,然后就直接顺着读下去了,我当时读出来的是这样的:Wonderful. You can read the message way better when the letters are in correct order. I think you would like to see...
2018-08-24 22:44:08 883
翻译 Transposition cipher 错位密码(维基百科词条)
在密码学中,错位密码是一种使明文单元的位置(“单元”通常是字符或者字符串)通过一种有规律的方式进行移动的加密方法,生成的密文构成明文的一个置换。也就是说,明文单元的顺序被改变了(明文被重新排序了)。在数学上,一个双射函数可以用来进行加密,使用该双射函数的反函数进行解密。下面是一些实现。栅轨道栏密码轨道栅栏密码是错位密码的一种形式,它的名字来源于它编码的方式。在轨道栅栏密码中,明文沿...
2018-08-24 22:31:51 6490
原创 WeChall Stegano Attachment
http://www.wechall.net/challenge/training/stegano/attachment/index.php这道题是一道经典的隐写题目,它把一个zip文件附加到了一个jpeg文件后面,zip文件的文件头标识是:504B0304,jpeg文件的标识头是FFD8FF,结尾标识是FFD9,使用UltraEdit查看attachement.php文件的十六进制内容: ...
2018-08-24 15:21:48 492
原创 LeetCode 对称二叉树
https://leetcode-cn.com/problems/symmetric-tree/description/我的解决方案:比较笨拙,我直接按照左后根遍历一遍,然后再按照右后根遍历一遍,最后比较结果class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { v...
2018-08-24 13:56:21 280
原创 LeetCode 相同的树
https://leetcode-cn.com/problems/same-tree/description/我的解决方案:class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; }}public class Solution { ...
2018-08-23 16:57:57 257
原创 LeetCode 删除排序链表中的重复元素 II (难度:中等)
https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list-ii/description/我的解决方案:class ListNode { int val; ListNode next; ListNode(int x) { val = x; }} public class Sol...
2018-08-22 15:54:57 237
原创 LeetCode 合并两个有序数组
https://leetcode-cn.com/problems/merge-sorted-array/description/我的解决方案:class Solution { public static void merge(int[] nums1, int m, int[] nums2, int n) { //这道题目的思路是先将nums1的元素全部移动至最后...
2018-08-22 13:27:37 459
原创 LeetCode 删除排序链表中的重复元素 I (难度:简单)
https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list/description/我的解决方案:class Solution { public ListNode deleteDuplicates(ListNode head) { if(head==null) return null; ...
2018-08-21 00:52:31 315
原创 LeetCode 爬楼梯
https://leetcode-cn.com/problems/climbing-stairs/description/我的第一个解决方案:(递归)超时class Solution { static int cnt=0; public static void recursion(int step,int n) { if(step==n) {cnt++;...
2018-08-20 22:50:58 251
原创 LeetCode
我的解决方案:处理一下溢出问题就OK了class Solution { public static int mySqrt(int x) { if(x==0) return 0; if(x<4) return 1; for(int i=0;i<=x/2;i++) { //if(i==46340) Sy...
2018-08-20 17:25:04 377
原创 LeetCode 二进制求和
https://leetcode-cn.com/problems/add-binary/description/我的解决方案: 因为给的二进制字符串可能会非常长,将其装换为整数会产生溢出,因此只能做字符串处理class Solution { public static String addBinary(String a, String b) { //较长字符串和...
2018-08-20 11:50:27 493
原创 LeetCode 加一
https://leetcode-cn.com/problems/plus-one/description/我的解决方案:class Solution { public int[] plusOne(int[] digits) { //carry用来存储进位 int carry = 0; int tmp = 0; i...
2018-08-19 18:26:38 286
原创 LeetCode 最后一个单词的长度
asdsahttps://leetcode-cn.com/problems/length-of-last-word/submissions/1我的解决方案:class Solution { public int lengthOfLastWord(String s) { if(s.equals("")) return 0; int i=s.leng...
2018-08-18 22:53:05 359
原创 LeetCode 最大子序和
https://leetcode-cn.com/problems/maximum-subarray/description/我的解决方案:这就道破题,我做了一个通宵。。。如果看不懂代码,可以看一下我下面的思路变迁,都是一点一点想出来的class Solution { public static int getRes3(int[] nums, int maxRes) { ...
2018-08-18 05:16:27 340
原创 LeetCode 报数
https://leetcode-cn.com/problems/count-and-say/description/我的解决方案:class Solution { public String solveIt(String str, int deepth) { if(str == "" || str == null) return ""; if(...
2018-08-17 20:42:46 420
原创 LeetCode 搜索插入位置
https://leetcode-cn.com/problems/search-insert-position/description/我的解决方案:二分class Solution { public static int searchInsert(int[] nums, int target) { if(nums.length==0) return 0; ...
2018-08-16 15:12:52 347
原创 LeetCode 实现strStr()
https://leetcode-cn.com/problems/implement-strstr/description/我的解决方案:public static int strStr(String haystack, String needle) { if(needle.length()>haystack.length())return -1; ...
2018-08-16 14:26:30 311
原创 LeetCode 移除元素
https://leetcode-cn.com/problems/remove-element/description/我的解决方案:class Solution { public int removeElement(int[] nums, int val) { if(nums.length==0) return 0; int...
2018-08-16 11:29:55 354
原创 LeetCode 删除排序数组中的重复项
https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/description/我的解决方案:class Solution { public int removeDuplicates(int[] nums) { int cnt=0; for(int i=0;i<...
2018-08-16 11:14:40 234
翻译 Windows VS 创建并使用动态链接库dll(C++)
本博客翻译自: https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2008/ms235636(v=vs.90)我们第一个要创建的库是一个动态链接库(下一篇是创建静态链接库)。使用动态链接库是一种高效的代码复用方式。相比在每一个你创建的程序中重写具有相同功能的代码而言,你可以只编写一次,然...
2018-08-15 22:55:30 2378
原创 LeetCode 合并两个有序链表
https://leetcode-cn.com/problems/merge-two-sorted-lists/description/ 感觉没有头节点的链表使用起来很麻烦:public class ListNode { int val; ListNode next; ListNode(int x) { val = x; } }class Solu...
2018-08-15 15:32:03 254
原创 LeetCode 有效的括号
其实就是括号匹配,直接用java封装的stack类来解决:import java.util.Stack;class Solution { public boolean isValid(String s) { Stack<Character> stack = new Stack<Character>(); for(int i...
2018-08-15 14:05:33 252
原创 LeetCode 最长公共前缀
https://leetcode-cn.com/problems/longest-common-prefix/description/ 我的解决方案:class Solution { public String longestCommonPrefix(String[] strs) { if(strs.length==0) return ""; St...
2018-08-15 12:06:32 296
原创 LeetCode 罗马数字转整数
https://leetcode-cn.com/problems/roman-to-integer/description/ 我的解决方案:使用HashMap将字符与数字做一个映射import java.util.HashMap;class Solution { public int romanToInt(String s) { HashMap<Cha...
2018-08-15 10:27:55 278
原创 LeetCode 回文数
https://leetcode-cn.com/problems/palindrome-number/description/代码:不转换成字符串来实现 和这篇文章的解决方案二一样的套路: https://blog.csdn.net/include_heqile/article/details/81638849class Solution { public boolean ...
2018-08-14 22:29:48 354
原创 LeetCode 反转整数
https://leetcode-cn.com/problems/reverse-integer/description/我的解决方案,因为直接相加会溢出,所以先减去最大值,正数与正数相减不会产生溢出class Solution { public static int reverse(int x) { int[] num = new int[100]; ...
2018-08-13 23:08:13 359
原创 LeetCode 两数之和
https://leetcode-cn.com/problems/two-sum/description/解决方案:class Solution { public int[] twoSum(int[] nums, int target) { Map&lt;Integer, Integer&gt; map = new HashMap&lt;&gt;(); ...
2018-08-12 13:59:27 202
原创 LeetCode contest 97
https://leetcode-cn.com/contest/weekly-contest-97/problems/uncommon-words-from-two-sentences/class Solution { public String[] uncommonFromSentences(String A, String B) { List&lt;String...
2018-08-12 13:55:29 321
原创 Leetcode 三数之和
https://leetcode-cn.com/problems/3sum/description/ 解决方案一:class Solution { public List&lt;List&lt;Integer&gt;&gt; threeSum(int[] nums) { List&lt;List&lt;Integer&gt;&gt; llList = n
2018-08-11 15:48:16 405
notepad++ zencoding插件notepad++ zencoding插件notepad++ zencoding插件
2021-02-21
WindowsFormsApp2.zip
2019-05-11
notepad++安装包
2017-11-10
Java学习笔记(更新)
2017-10-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人