목록PS/LeetCode (586)
넘치게 채우기
https://leetcode.com/problems/minimum-common-value/description/ Leetcode - Minimum Common Value 문제 유형 : 그리디, 투포인터 문제 난이도 : Easy 문제 Given two integer arrays nums1 and nums2, sorted in non-decreasing order, return the minimum integer common to both arrays. If there is no common integer amongst nums1 and nums2, return -1. Note that an integer is said to be common to nums1 and nums2 if both arrays h..
https://leetcode.com/problems/count-elements-with-maximum-frequency/description/ Leetcode - Count Elements With Maximum Frequency 문제 유형 : 해시, 그리디 문제 난이도 : Easy 문제 You are given an array nums consisting of positive integers. Return the total frequencies of elements in nums such that those elements all have the maximum frequency. The frequency of an element is the number of occurrences of that ele..
https://leetcode.com/problems/middle-of-the-linked-list/description/ Leetcode - Middle of the Linked List 문제 유형 : 연결리스트, 투포인터 문제 난이도 : Easy 문제 Given the head of a singly linked list, return the middle node of the linked list. If there are two middle nodes, return the second middle node. 단순 연결리스트의 헤드가 주어진다. 중간 노드를 반환하라. 두 개의 중앙 노드가 있다면, 두 번째 중앙 노드를 반환하라. 풀이 투 포인터를 이용해서 풀어주면 된다. 두 칸씩 이동하는 fast 한 칸..
https://leetcode.com/problems/minimum-length-of-string-after-deleting-similar-ends/description/ Minimum Length of String After Deleting Similar Ends - LeetCode Can you solve this real interview question? Minimum Length of String After Deleting Similar Ends - Given a string s consisting only of characters 'a', 'b', and 'c'. You are asked to apply the following algorithm on the string any number o..
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++ /** * ..