코딩
[LeetCode] Binary Tree Inorder Traversal
오늘의 문제는 이진 트리 구현해보기. 전에 멘토 언니가 공부한 담에 꼭 손으로 구현해 보세요, 라고 했는데 혼자선 안 할 거 같아서 냉큼 문제로 올렸다. leetcode.com/explore/interview/card/top-interview-questions-medium/108/trees-and-graphs/786/ 처음 삽질한 흔적. 아.. 길다... public class cote0310_786_BinaryTreeInorderTraversal { //Definition for a binary tree node. public class TreeNode { int val; TreeNode left; TreeNode right; TreeNode() {} TreeNode(int val) { this.val..
[LeetCode] Divisor Game
오늘의 문제는 일종의 숫자 게임의 규칙을 알아내야 하는 문제였다. leetcode.com/problems/divisor-game/ Divisor Game - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com /* Alice and Bob take turns playing a game, with Alice starting first. Initially, there is a number N on the chalkboard. On each player's turn, th..
[LeetCode] Fibonacci Number
오늘은 피보나치 배열. 재귀함수는 늘 헷갈린다. 이러는게 맞나? 이래도 되나? 그런 느낌. Fibonacci Number - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 처음 푼 방법 - 재귀함수 써보기. 런타임이 7~8ms 나왔다. class Solution { public int fib(int n) { if(n