목록PS/LeetCode (622)
넘치게 채우기
https://leetcode.com/problems/bag-of-tokens/description/ Leetcode - Bag of Tokens 문제 유형 : 그리디, 투포인터, 정렬 문제 난이도 : Medium 문제 You start with an initial power of power, an initial score of 0, and a bag of tokens given as an integer array tokens, where each tokens[i] donates the value of tokeni. Your goal is to maximize the total score by strategically playing these tokens. In one move, you can play ..
https://leetcode.com/problems/remove-nth-node-from-end-of-list/description/ Remove Nth Node From End of List - LeetCode Can you solve this real interview question? Remove Nth Node From End of List - Given the head of a linked list, remove the nth node from the end of the list and return its head. Example 1: [https://assets.leetcode.com/uploads/2020/10/03/remove_ex1.jpg] leetcode.com Leetcode - R..
https://leetcode.com/problems/squares-of-a-sorted-array/description/ Squares of a Sorted Array - LeetCode Can you solve this real interview question? Squares of a Sorted Array - Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. Example 1: Input: nums = [-4,-1,0,3,10] Out leetcode.com Leetcode - Squares of a S..
https://leetcode.com/problems/maximum-odd-binary-number/description/ Maximum Odd Binary Number - LeetCode Can you solve this real interview question? Maximum Odd Binary Number - 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 Leetcode - Maximum Odd Binary Number 문제 유형 : 문자열처리, 비트마스킹, 그리디 문제..
https://leetcode.com/problems/even-odd-tree/description/ LeetCode - Even Odd Tree 문제 유형 : 이진트리 문제 난이도 : Medium 문제 A binary tree is named Even-Odd if it meets the following conditions: The root of the binary tree is at level index 0, its children are at level index 1, their children are at level index 2, etc. For every even-indexed level, all nodes at the level have odd integer values in strictly..
https://leetcode.com/problems/find-bottom-left-tree-value/description/ Leetcode - Find Bottom Left Tree Value 문제 유형 : 트리, dfs, 재귀 문제 난이도 : Medium 문제 Given the root of a binary tree, return the leftmost value in the last row of the tree. 이진 트리의 루트가 주어진다. 트리의 마지막 행의 가장 왼쪽 값을 반환하시오. 풀이 dfs를 하면서, 각 노드의 왼쪽, 오른쪽별로 더 깊이 있는 노드를 재귀적으로 반환하면 된다. 의 형태로 값을 반환시킨다. 같은 깊이라면, 더 왼쪽의 노드를 상위 노드에 반환한다. 코드 C++ /** * ..
https://leetcode.com/problems/diameter-of-binary-tree/description/ Diameter of Binary Tree - LeetCode Can you solve this real interview question? Diameter of Binary Tree - Given the root of a binary tree, return the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path leetcode.com Leetcode - Diameter of Bin..
https://leetcode.com/problems/same-tree/description/ Same Tree - LeetCode Can you solve this real interview question? Same Tree - Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical, and the nodes have the leetcode.com LeetCode - Same Tree 문제 유형 : 트리, 탐색 문제 난이도 : Easy 문제 Gi..
https://leetcode.com/problems/cheapest-flights-within-k-stops/description/ Cheapest Flights Within K Stops - LeetCode Can you solve this real interview question? Cheapest Flights Within K Stops - There are n cities connected by some number of flights. You are given an array flights where flights[i] = [fromi, toi, pricei] indicates that there is a flight from city fromi to leetcode.com LeetCode -..
https://leetcode.com/problems/find-the-town-judge/description/ Find the Town Judge - LeetCode Can you solve this real interview question? Find the Town Judge - In a town, there are n people labeled from 1 to n. There is a rumor that one of these people is secretly the town judge. If the town judge exists, then: 1. The town judge trusts nobody. 2. E leetcode.com LeetCode - Find the Town Judge 문제 ..