반응형

PROGRAMING 108

[Algorithm] Reverse each word

Question :Convert input strint to new string with each word reversed.No punctuation in the string, each word separated by spaces.Casing should remain the same. 주어진 문장을 각각 거꾸로 해서 다시 출력하는 문제입니다. Solution : 이 문제를 풀기 위해서는 valildation과 normalization 그리고 search 알고리즘에 관한 지식이 필요합니다.먼저 입력값이 null거나 빈문자열인지를 확인한후 스페이스로 구분하여 배열에 저장하는 과정을 거칩니다.그런후 입력된 값을 거꾸로 반환 시켜 새로운 문자을 완성시킵니다.using System.Text;public class..

PROGRAMING/C# 05:14:16

[Algorithm] Valid Palindrome

Palindrome : 회문(回文) 또는 팰린드롬(palindrome)은 거꾸로 읽어도 제대로 읽는 것과 같은 문장이나 낱말, 숫자, 문자열(sequence of characters) 등입니다. Question :A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. Given a string s, return true if it is a palindro..

PROGRAMING/C# 2024.04.30

[Algorithm] Palindrome Number

Palindrome : 회문(回文) 또는 팰린드롬(palindrome)은 거꾸로 읽어도 제대로 읽는 것과 같은 문장이나 낱말, 숫자, 문자열(sequence of characters) 등입니다. Question:Given an integer x, return true if x is a palindrome, and false otherwise. Example 1: Input: x = 121 Output: true Explanation: 121 reads as 121 from left to right and from right to left.  Example 2: Input: x = -121 Output: false Explanation: From left to right, it reads -121. Fro..

PROGRAMING/C# 2024.04.27

[Algorithm] Integer to Roman

Question:Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol       Value I             1 V             5 X             10 L             50 C             100 D             500 M             1000For example, 2 is written as II in Roman numeral, just two one's added together. 12 is written as XII, which is simply X + II. The number 27 is written as XXVII, which..

PROGRAMING/C# 2024.04.25

[React] Ternary operators

Ternary operator 우리말로 하면 삼항 연산자라고 불리고 말 그대로 세개의 피연산자를 대상으로 합니다.간단하게 if ... else 문을 살펴보겠습니다.const name = 'Bob';if (name == 'Bob') { console.log('Hello, Bob');} else { console.log('Hello, Friend');};위 코드는 다음과 같이 작동합니다먼저 이름 변수를 선언하고 "Bob" 문자열로 설정합니다. 다음으로 if 문을 사용하여 이름 변수의 값이 "Bob"인지 확인합니다. 만약 그렇다면 console.log에서 "Bob"이라는 단어를 출력합니다.그렇지 않으면 이름 변수의 값이 "Bob"이 아닌 경우 다른 블록은 콘솔에서 "Hello, Friend"라는 단..

PROGRAMING/React 2024.04.25

[React] 화살표 함수 (Arrow Functions)

화살표 함수(Arrow Funcions) Arrow 함수는 함수를 작성할때 좀 더 간결하게 해줄수 있는 함수입니다. 기본 바로 예제를 통해 확인해 보겠습니다. // Before hello = function() { return "Hello World!"; } // With Arrow Function hello = () => { return "Hello World!"; } 간결해 졌습니다. 함수에 지정문이 하나만 있고 바로 그 값을 반환 한다면 아래와 같이 더 간결하게 만들수 있습니다. // Arrow Funtions Return Value by Default // Note: This works only if the function has only one statement. hello = () => "He..

PROGRAMING/React 2024.04.18
반응형