728x90

char 3

9. 문자와 문자열 (더하기 연산과 공백 저장)

char ch = 'A'; OK char ch = 'ab'; ERROR // 단 하나의 문자만 저장 가능 String s1 = "ab"; OK /*-------------------------------------------------*/ char ch = ''; ERROR // 빈 공간 저장 불가 String s1 = ""; OK // 연속되는 공간이 필요한 //자료형이므로 빈 내용으로 저장 가능 /*-------------------------------------------------*/ String s1 = "a" + "b"; // "ab" // 문자열끼리 더하면 하나의 문자열로 합쳐져서 반환 String s2 = "" + 7; // "7" // 문자열 + 숫자 = 하나의 문자열로 합쳐서 반환 /..

[leetCode] 1967. Number of Strings That Appear as Substrings in Word (Python)

▼ 문제 바로가기 (링크) ▼ https://leetcode.com/problems/number-of-strings-that-appear-as-substrings-in-word/ Number of Strings That Appear as Substrings in Word - LeetCode 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 return the number of strings in patterns that exist as a substring in word. A su..

[leetCode] 771. Jewels and Stones (Python)

▼ 문제 바로가기 (링크) ▼ https://leetcode.com/problems/jewels-and-stone/ Jewels and Stones - LeetCode 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 문자열 jewels과 stones이 주어진다. jewels의 각 문자는(char) 보석 종류를 나타내고 stones의 문자는 내가 가진 돌을 나타낸다. stones중 보석이 몇 개인지 구하고 반환하는 문제. class Solution: def numJewelsInSt..

728x90