본문 바로가기

Algorithm

(2139)
(C++) - LeetCode (easy) 389. Find the Difference https://leetcode.com/problems/find-the-difference/description/ Find the Difference - LeetCode Can you solve this real interview question? Find the Difference - You are given two strings s and t. String t is generated by random shuffling string s and then add one more letter at a random position. Return the letter that was added to t. Example 1: leetcode.com 전수조사 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 정답 변수 a..
(C++) - LeetCode (easy) 387. First Unique Character in a String https://leetcode.com/problems/first-unique-character-in-a-string/description/ First Unique Character in a String - LeetCode Can you solve this real interview question? First Unique Character in a String - Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1. Example 1: Input: s = "leetcode" Output: 0 Example 2: leetcode.com 간단 구현 문제..
(C++) - LeetCode (easy) 383. Ransom Note https://leetcode.com/problems/ransom-note/description/ Ransom Note - LeetCode Ransom Note - Given two strings ransomNote and magazine, return true if ransomNote can be constructed by using the letters from magazine and false otherwise. Each letter in magazine can only be used once in ransomNote. Example 1: Input: ransomNote = "a" leetcode.com 자료구조를 이용한 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 magazine에 나온 alph..
(C++) - LeetCode (easy) 367. Valid Perfect Square https://leetcode.com/problems/valid-perfect-square/description/ Valid Perfect Square - LeetCode Can you solve this real interview question? Valid Perfect Square - Given a positive integer num, return true if num is a perfect square or false otherwise. A perfect square is an integer that is the square of an integer. In other words, it is the product o leetcode.com 가우스의 제곱합 공식을 이용한 문제였습니다. 📕 풀이방법 ..
(C++) - LeetCode (easy) 350. Intersection of Two Arrays II https://leetcode.com/problems/intersection-of-two-arrays-ii/description/ Intersection of Two Arrays II - LeetCode Intersection of Two Arrays II - Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must appear as many times as it shows in both arrays and you may return the result in any order. Example 1: Input leetcode.com 전수조사 문제였습니다. 📕 풀이..
(C++) - LeetCode (easy) 349. Intersection of Two Arrays https://leetcode.com/problems/intersection-of-two-arrays/description/ Intersection of Two Arrays - LeetCode Can you solve this real interview question? Intersection of Two Arrays - Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any order. Example 1: In leetcode.com 간단 전수조사 문제였습니다. 📕 풀이방법 ..
(C++) - LeetCode (easy) 345. Reverse Vowels of a String https://leetcode.com/problems/reverse-vowels-of-a-string/description/ Reverse Vowels of a String - LeetCode Can you solve this real interview question? Reverse Vowels of a String - Given a string s, reverse only all the vowels in the string and return it. The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in both lower and upper cases, more than onc leetcode.com 문자열 구현 문제였습니다. 📕 풀이방..
(C++) - LeetCode (easy) 783. Minimum Distance Between BST Nodes https://leetcode.com/problems/minimum-distance-between-bst-nodes/description/ Minimum Distance Between BST Nodes - LeetCode Can you solve this real interview question? Minimum Distance Between BST Nodes - Given the root of a Binary Search Tree (BST), return the minimum difference between the values of any two different nodes in the tree. Example 1: [https://assets.leetcode.c leetcode.com 중위순회 문제..