본문 바로가기

Algorithm/String

(138)
(C++) - LeetCode (easy) 521. Longest Uncommon Subsequence I https://leetcode.com/problems/longest-uncommon-subsequence-i/description/ Longest Uncommon Subsequence I - LeetCode Can you solve this real interview question? Longest Uncommon Subsequence I - Given two strings a and b, return the length of the longest uncommon subsequence between a and b. If the longest uncommon subsequence does not exist, return -1. An uncommon subseq leetcode.com 문자열 문제였습니다. ..
(C++) - LeetCode (easy) 482. License Key Formatting https://leetcode.com/problems/license-key-formatting/description/ License Key Formatting - LeetCode Can you solve this real interview question? License Key Formatting - You are given a license key represented as a string s that consists of only alphanumeric characters and dashes. The string is separated into n + 1 groups by n dashes. You are also given a leetcode.com 문자열 재구성 문제였습니다. 📕 풀이방법 📔 입력 ..
(C++) - LeetCode (easy) 459. Repeated Substring Pattern https://leetcode.com/problems/repeated-substring-pattern/description/ Repeated Substring Pattern - LeetCode Can you solve this real interview question? Repeated Substring Pattern - Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. Example 1: Input: s = "abab" Output: true Expl leetcode.com 문자열을 다루는 문제였습니다. 📕 풀이방법..
(C++) - LeetCode (easy) 434. Number of Segments in a String https://leetcode.com/problems/number-of-segments-in-a-string/description/
(C++) - LeetCode (easy) 412. Fizz Buzz https://leetcode.com/problems/fizz-buzz/description/ Fizz Buzz - LeetCode Can you solve this real interview question? Fizz Buzz - Given an integer n, return a string array answer (1-indexed) where: * answer[i] == "FizzBuzz" if i is divisible by 3 and 5. * answer[i] == "Fizz" if i is divisible by 3. * answer[i] == "Buzz" if i is leetcode.com 구현 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 정답 vector ans를 선언해줍니다. 📔 풀..
(C++) - LeetCode (easy) 28. Find the Index of the First Occurrence in a String https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/description/ Find the Index of the First Occurrence in a String - LeetCode Can you solve this real interview question? Find the Index of the First Occurrence in a String - Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. E..
(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) 344. Reverse String https://leetcode.com/problems/reverse-string/description/ Reverse String - LeetCode Reverse String - Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place [https://en.wikipedia.org/wiki/In-place_algorithm] with O(1) extra memory. Example 1: leetcode.com 문자열 관련 함수 reverse를 사용해보는 문제였습니다. 📕 풀이방법 📔 풀이과정 ..