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
- Hp바
- Animation State Machine
- 유니티
- rigidbody
- raycasting
- rotation
- Vector3
- Unity
- Parallax
- 2D슈팅게임
- Transform
- Prefabs
- 오브젝트 풀링
- 패럴렉스
- Scrooling
- Blend Type
- Ainimation Blending
- CSharp #자료구조
- 스크롤링
- LayerMark
- raycast
- joystick
- Object Poling
- apk
- 플레이어 방향전환
- 일시정지
- 플레이어 이동
- 프리팹
- Hpbar
- Object Pooling
Archives
- Today
- Total
주녘공부일지
[프로그래머스 C#] Lv.2 타겟 넘버 본문
728x90
https://school.programmers.co.kr/learn/courses/30/lessons/43165
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
1. 정답코드 및 핵심 아이디어, 유의사항
- 배열 안의 부호를 변경할 수 있는 모든 경우의 수를 체크해야 함 // 배열은 참조형식 자료형
- DFS(Depth First Search) : 깊이우선탐색
https://godgjwnsgur7.tistory.com/47
[C#] DFS(Depth First Search), BFS(Breadth First Search)
1. DFS(Depth First Search) - 깊이 우선 탐색 조합류 최단거리로 갈 수 있는 경로의 수, 목적지 도달 여부, 등에 사용 - 스택(LIFO) 사용, 재귀 함수 사용 // 스택을 이용 public void DFS(int index) { Node root = nodes[
godgjwnsgur7.tistory.com
using System;
public class Solution
{
public int count = 0;
public int solution(int[] numbers, int target)
{
Function(numbers, target, -1);
return count;
}
public void Function(int[] numbers, int target, int index)
{
index++;
if (numbers.Length == index)
{
int total = 0;
foreach (int num in numbers)
total += num;
if (total == target)
count++;
return;
}
Function(numbers, target, index);
numbers[index] *= -1;
Function(numbers, target, index);
}
}
728x90
'Programmers - C# > CodingTest Lv.2' 카테고리의 다른 글
[프로그래머스 C#] Lv.2 뒤에 있는 큰 수 찾기 (0) | 2023.09.18 |
---|---|
[프로그래머스 C#] Lv.2 숫자 변환하기 (0) | 2023.09.07 |
[프로그래머스 C#] Lv.2 기능개발 (0) | 2023.09.03 |
[프로그래머스 C#] Lv.2 연속된 부분 수열의 합 (0) | 2023.08.30 |
[프로그래머스 C#] Lv.2 연속 부분 수열 합의 개수 (0) | 2023.08.25 |