본문 바로가기

전체 글

(105)
[C# Python Java] is operator, instanceof operator [Python] is operator, is not operatorhttps://www.geeksforgeeks.org/difference-operator-python/ [C#] is operator, as operatorhttps://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/ishttps://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/ashttps://www.geeksforgeeks.org/c-sharp-is-operator-keyword/https://www.geeksforgeeks.org/c-sharp-as-operator-keyword/http..
[C# C++ Python] verbatim string, raw string literal [C#] verbatim stringusing System; namespace Sharp1{ class Program { static void Main(string[] args) { Console.WriteLine("c:\next\race\folder\test1.xlsx"); Console.WriteLine(@"c:\next\race\folder\test1.xlsx"); // verbatim string Console.ReadKey(); } }} [C#] interpolated stringhttps://docs.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated [C#] verbatim stringhttps://docs.mic..
Integer to Binary Conversion [Python] # Python 3 print(bin(int(input())))
Integer to Binary Conversion [Java] // Java package package1; import java.util.Scanner; public class Program { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)) { int number = sc.nextInt(); String binary = Integer.toBinaryString(number); System.out.println(binary); } catch (Exception ex) { System.err.println(ex.getMessage()); } }}
Integer to Binary Conversion [C#] // C# using System; namespace ToBinary{ class Program { static void Main(string[] args) { string input = Console.ReadLine(); int number = Convert.ToInt32(input); string binary = Convert.ToString(number, 2); Console.WriteLine(binary); } }}
Integer to Binary Conversion [C/C++] // C/C++ // [VC] suppress error messages about obsolete & deprecated functions#pragma warning(disable : 4996)#define _CRT_SECURE_NO_WARNINGS#define _CRT_SECURE_NO_WARNINGS_GLOBALS #include #include #define LENGTH 11 int main(int argc, char **argv){ char buffer[LENGTH]; int number = 0; do { fgets(buffer, LENGTH, stdin); number = atoi(buffer); } while (number < 0); printf("%12s %d\n", "Integer", n..
[HackerRank] The Coin Change Problem https://www.hackerrank.com/challenges/coin-change/problem def get_ways(n, c): return [[]] if n == 0 else [[b, *j] for i, b in enumerate(c) if b = coin: for way in get_ways(change - coin, coins[i:]): my_ways.append([coin, *way]) return my_ways n = int(input("Target Change: ").strip())c = list(map(int, input("Coin List: ").strip().split()))c.sort()ways = get_ways(n, c)print("Number of Ways:", len(..
[HackerRank] Super Reduced String https://www.hackerrank.com/challenges/reduced-string/problem # Python 3 def reduce_string(s): for i, x in enumerate(s[1:]): if s[i] == x: return reduce_string(s[:i] + s[i + 2:]) return s result = reduce_string(input().strip())print(result) if result != '' else print('Empty String') # Python 3 def reduce_string(s): str_list = list(s) index = 0 while len(str_list) > 1 and index < len(str_list) - 1..