59. c# 2차원 배열 행렬 전치 문제
주어진 2차원 배열의 행과 열을 바꾼 전치 행렬을 출력하세요. 출력 예: 코드는 아래에~~~~ 1234567891011121314151617181920212223242526272829303132333435using System; class Program{ static void Main() { int[,] array = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; int rows = array.GetLength(0); int cols = array.GetLength(1); int[,] transposed..
2025. 1. 21.
c# 문제 56. 주어진 정수형 배열의 범위 중 빠진 숫자들 찾기
주어진 배열의 정수 범위 중 빠진 숫자를 찾아 출력하는 코드를 작성하세요.1,3,4,5,7,8,10,11,15 코드는 아래에~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1234567891011121314 class Program { static void Main() { int[] arr = new int[] { 1, 3, 4, 5, 7, 8, 10, 11, 15 }; int cnt = 0; for(int i = 1; i = 15; i++) { if (arr[cnt] == i) cnt++; ..
2024. 1. 29.
c# 문제 55. 배열에서 두 요소의 합이 특정 값이 되는 모든 요소 쌍 찾기
주어진 배열의 두 요소의 합이 입력 받은 값이 되는 모든 요소 쌍 찾는 코드를 작성하세요. int[] array = { 1, 2, 3,4,5,6,7,8,9,-1,-2,-3,-4,-5};출력 예) 코드는 아래에~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1234567891011121314151617181920212223using System;class Program { static void Main() { int[] array = { 1, 2, 3,4,5,6,7,8,9,-1,-2,-3,-4,-5}; int target = 0; ..
2023. 12. 15.
c# 문제 54. 배열의 교집합 요소 찾기
두 개의 정수 배열이 주어졌을 때, 두 배열의 교집합을 찾는 코드를 작성하세요. int[] array1 = { 1, 3, 5, 7, 9 }; int[] array2 = { 3, 6, 7, 8, 9 }; 출력 예)코드는 아래에~~~~~~~~~~~~~~~~~~~~~ 1234567891011121314151617181920212223242526272829using System;using System.Collections.Generic; class IntersectArrays{ static void Main(string[] args) { int[] array1 = { 1, 3, 5, 7, 9 }; int[] arr..
2023. 12. 14.