Problem solving 44

[프로그래머스]최댓값과 최솟값 (C#)

https://school.programmers.co.kr/learn/courses/30/lessons/12939 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 더보기더보기 Problem Description문자열 s에는 공백으로 구분된 숫자들이 저장되어 있습니다.str에 나타나는 숫자 중 최소값과 최대값을 찾아 이를 "(최소값) (최대값)"형태의 문자열을 반환하는 함수, solution을 완성하세요. 예를들어 s가 "1 2 3 4"라면 "1 4"를 리턴하고, "-1 -2 -3 -4"라면 "-4 -1"을 리턴하면 됩니다. Constraints:s에는 둘 이상의 정수가 공백으로 구분되어 있습니다. My Solut..

[프로그래머스]약수의 합 (C#)

프로그래머스 - 약수의 합 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krProblem Description정수 n을 입력받아 n의 약수를 모두 더한 값을 리턴하는 함수, solution을 완성해주세요. Example: nreturn122856 Constraints:n은 0 이상 3000이하인 정수입니다. My Solution (C#)public static int Solution(int n){ int answer = 0; for(int i = 1; i

[LeetCode] 35. Search Insert Position (C#)

LeetCode - Problems - Algorithms - 35. Search Insert Position Problem Description Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. My Solution (C#) nums에 target을 insert한다고 가정 했을 때, insert 되는 위치를 return하는 문제. nums는 오름차순으로 정렬되어있고, target 또한 오름차순에 맞게 insert 되어야 한다는 조건이 있다. ..

[LeetCode] 28. Implement strStr() (C#)

LeetCode - Problems - Algorithms - 28. Implement strStr() Problem Description My Solution (C#) 변수 이름에서 알 수 있듯이, 주어진 string 건초더미에서 string 바늘이 있는지 찾는 문제이다. C#의 IndexOf (C의 경우는 StrStr)를 구현하는 문제다. Description을 끝까지 안읽어서 (끝까지 읽읍시다...) IndexOf를 사용해서 풀었다. (??) // Implementing IndexOf by using IndexOf (???) public class Solution { public int StrStr(string haystack, string needle) { if (string.IsNullOrEmp..