본문 바로가기

Algorithm/String

(92)
(C++) - LeetCode (easy) 557. Reverse Words in a String III https://leetcode.com/problems/reverse-words-in-a-string-iii/description/
(C++) - LeetCode (easy) 541. Reverse String II https://leetcode.com/problems/reverse-string-ii/description/ Reverse String II - LeetCode Can you solve this real interview question? Reverse String II - Given a string s and an integer k, reverse the first k characters for every 2k characters counting from the start of the string. If there are fewer than k characters left, reverse all of them. leetcode.com 문자열을 다루는 문제였습니다. 📕 풀이방법 📔 풀이과정 2*k만큼 증..
(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..