G

@gcl888

C# find intersection of two arrays

C#
2 years ago
using System; using System.Linq; class Program { static void Main() { int[] array1 = { 1, 2, 3, 4, 5 }; int[] array2 = { 4, 5, 6, 7, 8 }; int[] intersection = array1.Intersect(array2).ToArray();

C# rCheck if a number is Armstrong

C#
2 years ago
using System; class Program { static void Main() { int number = 153; int original = number; int result =

C# reverse series of numbers

C#
2 years ago
using System; class Program { static void Main() { int number = 12345; int reversed = 0; while (number > 0)

C# Fibonacci series

C#
2 years ago
using System; class Program { static void Main() { int n = 10; int first = 0; int second = 1;

C# Find the first non-repeating character in a string.

C#
2 years ago
using System; using System.Collections.Generic; class Program { static void Main() { string str = "aabbcdd"; Dictionary<char, int> frequencyMap = new Dictionary<char, int>();

C# bubble sort ascending array

C#
2 years ago
using System; class Program { static void Main() { int[] array = { 5, 3, 9, 2, 7 }; for (int i = 0; i < array.Length - 1; i++) {

C# palindrome

C#
2 years ago
using System; class Program { static void Main() { string str = "madam"; bool isPalindrome = true; for (int i = 0; i < str.Length / 2; i++)

C# iCount the frequency of each element in an array.

C#
2 years ago
using System; using System.Collections.Generic; class Program { static void Main() { int[] array = { 2, 3, 4, 2, 1, 3, 4 }; Dictionary<int, int> frequencyMap = new Dictionary<int,

C# int.MinValue second largest number

C#
2 years ago
using System; class Program { static void Main() { int[] array = { 5, 3, 9, 2, 7 }; int max = int.MinValue; int secondMax = int.MinValue;

C# int.MinValue

C#
2 years ago
using System; class Program { static void Main() { int[] array = { 5, 3, 9, 2, 7 }; int max = int.MinValue; foreach (int num in array)

C# reverse array

C#
2 years ago
using System; class Program { static void Main() { string str = "Hello World"; char[] charArray = str.ToCharArray(); Array.Reverse(charArray); string reversedStr = new string(charArray);

Linked list cs

C#
2 years ago
using System; namespace MyCompiler { class Program { public static void Main(string[] args) { Console.WriteLine("Hello world!"); } } }

check if string is a palindrome c++

C++
2 years ago
#include <stdio.h> #include <string.h> int isPalindrome(const char* str) { int i = 0; int j = strlen(str) - 1; while (i < j) {

check if number is a palindrome cs

C#
2 years ago
using System; class Program { static void Main() { int number = 12321; //string number = "dakad"; int original = number;

sum a list of numbers. cs

C#
2 years ago
using System; class Program { static void Main() { int[] array = { 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5 }; int sum = 0; //int sum;

sum a list of numbers. cs

C#
2 years ago
using System; class Program { static void Main() { int[] array = { 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5 }; int sum = 0; //int sum;

: Remove duplicates from a list of numbers. cs

C#
2 years ago
using System; using System.Linq; class Program { static void Main() { int[] numbers = { 1, 2, 2, 3, 3, 4, 5, 5 }; var distinctNumbers = numbers.Distinct();

: Remove duplicates from a list of numbers. cs

C#
2 years ago
using System; using System.Linq; class Program { static void Main() { int[] numbers = { 1, 2, 2, 3, 3, 4, 5, 5 }; var distinctNumbers = numbers.Distinct();

: Remove duplicates from a string. cs

C#
2 years ago
using System; using System.Linq; class Program { static void Main() { string str = "hello"; string uniqueStr = new string(str.Distinct().ToArray()); Console.WriteLine("Unique String: " + uniqueStr);

Find the intersection of two arrays cs

C#
2 years ago
using System; using System.Linq; class Program { static void Main() { int[] array1 = { 1, 2, 3, 4, 5 }; int[] array2 = { 4, 5, 6, 7, 8 }; int[] intersection = array1.Intersect(array2).ToArray();