[Easy] 28. Implement strStr()
leetCode 2022. 6. 9. 11:16

문제 Implement strStr(). 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. Clarification: What should we return when needle is an empty string? This is a great question to ask during an interview. For the purpose of this problem, we will return 0 when needle is an empty string. This is consistent to C's s..

[Easy] 389. Find the Difference
leetCode 2022. 6. 2. 12:12

문제 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. 두 개의 문자열과 t가 주어집니다. 문자열 t는 임의의 셔플링 문자열에 의해 생성된 다음 임의의 위치에 문자를 하나 더 추가합니다. t에 추가된 문자를 반환한다. 예시 Example 1: Input: s = "abcd", t = "abcde" Output: "e" Explanation: 'e' is the letter that was added. Example 2: Input: s = ""..

[Easy] 1678. Goal Parser Interpretation
leetCode 2022. 6. 2. 12:09

문제 You own a Goal Parser that can interpret a string command. The command consists of an alphabet of "G", "()" and/or "(al)" in some order. The Goal Parser will interpret "G" as the string "G", "()" as the string "o", and "(al)" as the string "al". The interpreted strings are then concatenated in the original order. Given the string command, return the Goal Parser's interpretation of command. 문자..

[Easy] 953. Verifying an Alien Dictionary
leetCode 2022. 6. 2. 12:07

문제 Easy 2841940Add to ListShare In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters. Given a sequence of words written in the alien language, and the order of the alphabet, return true if and only if the given words are sorted lexicographically in this alien language. 외계..

[Easy] 1309. Decrypt String from Alphabet to Integer Mapping
leetCode 2022. 6. 2. 11:23

문제 You are given a string s formed by digits and '#'. We want to map s to English lowercase characters as follows: Characters ('a' to 'i') are represented by ('1' to '9') respectively. Characters ('j' to 'z') are represented by ('10#' to '26#') respectively. Return the string formed after mapping. The test cases are generated so that a unique mapping will always exist. s숫자 및 '#'로 구성된 문자열이 제공 됩니다..

[Easy] 709. To Lower Case
leetCode 2022. 6. 2. 10:48

문제 Given a string s, return the string after replacing every uppercase letter with the same lowercase letter. s 문자열이 주어졌을 때, 모든 대문자들을 소문자로 변환하여라. 예시 Example 1: Input: s = "Hello" Output: "hello" Example 2: Input: s = "here" Output: "here" Example 3: Input: s = "LOVELY" Output: "lovely" 제약 조건 Constraints: 1

[Easy] 1768. Merge Strings Alternately
leetCode 2022. 6. 2. 10:44

문제 You are given two strings word1 and word2. Merge the strings by adding letters in alternating order, starting with word1. If a string is longer than the other, append the additional letters onto the end of the merged string. Return the merged string. 예시 Example 1: Input: word1 = "abc", word2 = "pqr" Output: "apbqcr" Explanation: The merged string will be merged as so: word1: a b c word2: p q ..

[Easy] 1790. Check if One String Swap Can Make Strings Equal
leetCode 2022. 5. 30. 01:21

문제 You are given two strings s1 and s2 of equal length. A string swap is an operation where you choose two indices in a string (not necessarily different) and swap the characters at these indices. Return true if it is possible to make both strings equal by performing at most one string swap on exactly one of the strings. Otherwise, return false. 예시 Example 1: Input: s1 = "bank", s2 = "kanb" Outp..