일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
- GraphQL
- #abex크랙미
- Spring
- Easy
- #크랙미3번
- #심플즈 크랙미
- #크랙미2번
- #보안이슈
- java8
- #크랙미 9번
- #고클린
- java
- 리버싱
- #파밍
- #abex
- #abex크랙미4번
- #리버싱
- #크랙미 10번
- #크랙미4번
- springframework
- #크랙미
- #심플즈
- leetcode
- #보안뉴스
- #크랙미 5번
- Today
- Total
목록Easy (5)
Halo World
https://leetcode.com/problems/merge-two-binary-trees/ class Solution { public TreeNode mergeTrees(TreeNode root1, TreeNode root2) { TreeNode head = root1; if(root1==null && root2==null) return null; if(root1==null && root2!=null) return root2; if(root1!=null && root2==null) return root1; root1.val+=root2.val; root1.left = mergeTrees(root1.left, root2.left); root1.right = mergeTrees(root1.right, ..
https://leetcode.com/problems/count-binary-substrings/ //풀이 봄 class Solution { /*public int countBinarySubstrings(String s) { int[] groups = new int[s.length()]; int idx = 0; groups[0]=1; for(int i=1;i
https://leetcode.com/problems/symmetric-tree/ class Solution { public boolean isSymmetric(TreeNode root) { return isMirror(root.right, root.left); } private boolean isMirror(TreeNode n1, TreeNode n2){ if(n1==null || n2==null) return n1==n2; return (n1.val == n2.val && isMirror(n1.left, n2.right) && isMirror(n1.right, n2.left)); } }
https://leetcode.com/problems/invert-binary-tree/ class Solution { public TreeNode invertTree(TreeNode root) { TreeNode head= root; if(root!=null) invert(root); return head; } private void invert(TreeNode n1) { if(n1==null) return; invert(n1.right); invert(n1.left); TreeNode tmp = n1.right; n1.right = n1.left; n1.left = tmp; } }
https://leetcode.com/problems/diameter-of-binary-tree/ class Solution { int max=0; public int diameterOfBinaryTree(TreeNode root) { int left = findDepth(root.left); int right = findDepth(root.right); return Math.max(left + right, max); } int findDepth(TreeNode node) { if(node==null) return 0; int left = findDepth(node.left); int right = findDepth(node.right); max = Math.max(left + right, max); r..