728x90

알고리즘/해결 43

LeetCode1365. How Many Numbers Are Smaller Than the Current Number

1. 문제(원본) Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i]. Return the answer in an array. Example 1: Input: nums = [8,1,2,2,3] Output: [4,0,1,1,3] Explanation: For nums[0]=8 there exist four smaller numbers than it (1, 2, 2 and 3). For nums..

알고리즘/해결 2020.03.08

LeetCode709. To Lower Case

1. 문제(원본) Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase. Example 1: Input: "Hello" Output: "hello" Example 2: Input: "here" Output: "here" Example 3: Input: "LOVELY" Output: "lovely" 2. 문제 임의의String 문자열을 받아 대문자를 소문자로 출력하라 3. 나의 답 class Solution { func toLowerCase(_ str: String) -> String { var resultString = "" for element in str { let..

알고리즘/해결 2020.01.26
728x90