본문 바로가기
728x90

전체 글228

Codesignal - alphabeticShift Given a string, your task is to replace each of its characters by the next one in the English alphabet; i.e. replace a with b, replace b with c, etc (z would be replaced by a). Example For inputString = "crazy", the output should be alphabeticShift(inputString) = "dsbaz". 설명 inputString의 각 문자를 알파벳 순서에 맞게 다음 알파벳으로 바꿔라 풀이 문자열의 각 문자들을 인코딩한 값에 1을 더하여 아스키코드에 맞는 문자를 리턴 func alphabeticShift(inputString.. 2021. 4. 29.
Codesignal - almostIncreasingSequence Given a sequence of integers as an array, determine whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the array. Note: sequence a0, a1, ..., an is considered to be a strictly increasing if a0 < a1 < ... < an. Sequence containing only one element is also considered to be strictly increasing. Example For sequence = [1, 3, 2, 1], the output sh.. 2021. 4. 29.
Codesignal - allLongestString Given an array of strings, return another array containing all of its longest strings. Example For inputArray = ["aba", "aa", "ad", "vcd", "aba"], the output should be allLongestStrings(inputArray) = ["aba", "vcd", "aba"]. 설명 인풋 스트링 배열의 원소 중 길이가 가장 긴 원소만 리턴 풀이 max()이용하여 길이가 가장 긴 원소를 찾아서 필터링 func allLongestStrings(inputArray: \[String\]) \-> \[String\] { let max \= inputArray.max(by: {$0.count < .. 2021. 4. 27.
Codesignal - adjacent Elements Product Given an array of integers, find the pair of adjacent elements that has the largest product and return that product. Example. For inputArray = [3, 6, -2, -5, 7, 3], the output should be adjacentElementsProduct(inputArray) = 21. 7 and 3produce the largest product. Input/Output [execution time limit] 20 seconds (swift) [input] array.integer inputArrayGuaranteed constraints: 2 ≤ inputArray.length ≤.. 2021. 4. 27.
Codesignal - addBorder Given a rectangular matrix of characters, add a border of asterisks(*) to it. Example For picture = ["abc", "ded"] the output should be addBorder(picture) = ["*****", "*abc*", "*ded*", "*****"] 설명 *을 원소 앞뒤에 넣고 배열 처음과 마지막에 문자 길이 만큼 넣는다 풀이 pictrue 원소에 먼저 문자 앞뒤에 *을 넣어주고 문자 길이 만큼 picture 맨 앞뒤에 넣어줄 필요한 길이의 별을 star에 저장하고 picture 앞뒤에 넣어줌 func addBorder(picture: [String]) -> [String] { var matrix = pict.. 2021. 4. 27.
Codesignal - absoluteValuesSumMinimization Given a sorted array of integers a, your task is to determine which element of a is closest to all other values of a. In other words, find the element x in a, which minimizes the following sum: abs(a[0] - x) + abs(a[1] - x) + ... + abs(a[a.length - 1] - x) (where abs denotes the absolute value) If there are several possible answers, output the smallest one. Example For a = [2, 4, 7], the output .. 2021. 4. 26.
플랫으로 이사 5월 17일~ 아침 일찍 부터 무거운 짐을 택시에 싣고 정들었던 백패커에서 플랫아파트로 이사 주155NZD에 전기,인터넷 포함, 물은 200NZD이상 나오면 N/1 이정도 집에 이 금액이면 나쁘지 않은것 같다 2016. 7. 5.
더 스테이션 백패커 오클랜드 공항에 픽업 나오신 유학원 직원 분들 도움으로 유심을 바로 구입하고 내가 예약한 백패커로 향했다. 차 안에서 본 뉴질랜드는 건물 낮고 예뻤고 여유롭고 햇살이 눈부신 곳이었다. 2016. 05.10 ~ 17 (일주일) 백패커 앞에 도착해보니 생각보다 건물이 많이 오래되어 보였다. 입구에 들어서니 리셉션과 작은 휴식공간이 있다. 체크인을 마치고 방 키를 받았다. 7층 708호 백패커 주인 아저씨가 엘리베이터는 6층까지만 운행된다고 한다... 무거운 캐리어를 끌고 한 층을 올라가야 했지만! 유학원 직원분이 방까지 짐을 옮겨 주셨다. 엄청 무거웠는데...감사합니다ㅎ 건물이 30년이 지나면 천장도 무너지는건가.... 방문 앞 천장이 뻥 뚫려있다... 7층 복도 내가 예약한 여성전용 4인실 아무도 없어, .. 2016. 5. 25.
5월 10일 도착 시드니 행 비행기를 타고 어느덧 하루가 넘어갔다. 인천에서 시드니까지 10시간 정도 걸린듯? 시드니에 도착하니 오전 8시 경 비행기에서 내리자 마자 갈아타기 위해 서둘러 걸었다. 다른 사람들 글 보니 안내가 잘 되어있다고 하던데 아니다...결국 한바퀴를 돌고 transit 입구 도착.... 사실 복잡하지도 않은데 transfer와 transit을 햇갈려서 해맸다..ㅠ transit입구에서 줄을 스면 수화물 검사를 한다. 그런데 여기서 보통 바로바로 pass를 하는데 왜 난 소지품 검사를 당한 것인가...걸릴 만한 물건도 없었는데.. 역시나 검사하고 이상없었다 검사를 마치고 환승 보딩패스를 받기위해 콴타스항공 리셉션을 찾았지만 보이지 않는다. 일단 편명 안내판을 보고 게이트로 향했다. 게이트에 도착하니 이.. 2016. 5. 19.