250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- apk
- raycast
- Transform
- 플레이어 이동
- Unity
- Parallax
- joystick
- rigidbody
- Vector3
- Object Poling
- 2D슈팅게임
- 일시정지
- Scrooling
- Hpbar
- 유니티
- raycasting
- LayerMark
- 오브젝트 풀링
- Ainimation Blending
- Object Pooling
- 스크롤링
- 플레이어 방향전환
- 패럴렉스
- Animation State Machine
- Hp바
- Blend Type
- 프리팹
- rotation
- Prefabs
- CSharp #자료구조
Archives
- Today
- Total
주녘공부일지
[프로그래머스 C#] Lv.1 숫자 짝꿍 본문
728x90
https://school.programmers.co.kr/learn/courses/30/lessons/131128
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
1. 정답코드 및 핵심 아이디어, 유의사항
- Lv.1이라고 굉장히 쉽게 생각하고 생각없이 string을 사용했다가 시간초과를 경험함
https://godgjwnsgur7.tistory.com/66
[C#] StringBuilder vs String 성능차이 비교
godgjwnsgur7.tistory.com
using System;
using System.Linq;
using System.Text;
public class Solution
{
public string solution(string X, string Y)
{
StringBuilder sb = new StringBuilder();
int[] ints1 = new int[10];
int[] ints2 = new int[10];
foreach (Char c in X)
ints1[c - '0']++;
foreach (Char c in Y)
ints2[c - '0']++;
for (int i = 9; i >= 0; i--)
{
int count = ints1[i] < ints2[i] ? ints1[i] : ints2[i];
for (int j = 0; j < count; j++)
sb.Append(i);
}
if (sb.Length == 0)
return "-1";
if (sb.ToString().ToCharArray().Where<Char>(x => x == '0').Count() == sb.Length)
return "0";
return sb.ToString();
}
}
728x90
'Programmers - C# > CodingTest Lv.1' 카테고리의 다른 글
[프로그래머스 C#] Lv.1 대충 만든 자판 (0) | 2023.08.30 |
---|---|
[프로그래머스 C#] Lv.1 둘만의 암호 (0) | 2023.08.23 |
[프로그래머스 C#] Lv.1 성격 유형 검사하기 (0) | 2023.08.22 |
[프로그래머스 C#] Lv.1 달리기 경주 (0) | 2023.08.20 |
[프로그래머스 C#] Lv.1 공원 산책 (0) | 2023.08.18 |