본문 바로가기
반응형

전체 글552

Privacy Policy Privacy Policy This Privacy Policy describes how we collect, use, and share personal information when you visit or interact with our website or app. We are committed to protecting your privacy and ensuring the security of your personal information. 1. Information We Collect We may collect the following types of personal and non-personal information when you use our website or app: Information co.. 2023. 9. 8.
프로그래머스 C# - 올바른 괄호 풀이 '(' ')'의 숫자들을 종이에 하나씩 적어보면 로직이 쉽게 보인다. public class Solution { public bool solution(string s) { bool answer = true; Stackstack = new Stack(); int right = 0; int left = 0; for(int i =0;i 2023. 9. 7.
프로그래머스 C# - 최솟값 만들기 풀이 이것저것 끄적이다가 A는 작은 순서대로 B는 큰 순서대로 앞에서 부터 곱하고 더하면 그 결과가 답인 것을 알게 되었다. 1. A와 B Sort 2. B Reverse 3. 앞에서부터 각각 곱하고 다 더하면 정답이 나온다. public class Solution { public int solution(int[] A, int[] B) { int answer = 0; Array.Sort(A); Array.Sort(B); Array.Reverse(B); for(int i=0;i 2023. 9. 6.
C# - DFS(깊이우선탐색)개념 및 코드 구현 깊이 우선 탐색(DFS, Depth-First Search)특정 노드에서 시작하여 그래프를 탐색하면서 제일 깊은 곳으로 들어갔다가 더 이상 들어갈 곳이 없게 되면 다시 돌아와 다른 경로로 탐색을 진행한다. 이를 통해 모든 노드를 방문하고자 할때 사용할 수 있는 탐색 알고리즘이다.1. 행렬01 그래프 행렬로 표현int[,] adj = new int[10, 10]{ {0,1,0,0,0,0,0,1,0,0 }, {1,0,1,0,1,0,0,0,0,0 }, {0,1,0,1,0,0,0,0,0,0 }, {0,0,1,0,0,0,0,0,0,0 }, {0,1,0,0,0,1,1,1,0,0 }, {0,0,0,0,1,0,0,0,0,0 }, {0,0,0,0,1,0,0,0,0,0 }, {1.. 2023. 9. 6.
프로그래머스 C# - JadenCase 문자열 만들기 첫 문자가 대문자이고 그 외의 알파벳은 소문자인 문자열 1) 문자열 소문자로 일단 만들기 2)그리고 첫번째 요소들만 대문자로 만들기 public class Solution { public string solution(string s) { string[] token = s.ToLower().Split(" "); string answer = ""; for(int i=0; i 공백 문자 삭제하기 public class Solution { public string solution(string s) { string[] token = s.ToLower().Split(" "); string answer = ""; for(int i=0; i 2023. 9. 5.
C# - 연결리스트 구현 1. 노드 생성하기 class MyLinkedListNode{ public T Data; public MyLinkedListNode Next; public MyLinkedListNode Prev;}그림 참조2. 연결리스트 클래스 class MyLinkedList01 연결리스트 기본 구조 설정public MyLinkedListNode Head = null; // 첫번째 노드public MyLinkedListNode Tail = null; // 마지막 노드public int Count = 0; // 연결 리스트에 연결된 노드의 수그림 참조02 AddLast public MyLinkedListNode AddLast(T data){ MyLinkedListNode newRoom = new .. 2023. 9. 4.
반응형