This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Collections.Specialized; | |
using System.IO; | |
using System.Linq; | |
using System.Net.Http; | |
using System.Net.Http.Headers; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
class Solution { | |
static void Main(String[] args) { | |
int i = 4; | |
double d = 4.0; | |
string s = "HackerRank "; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Complete the 'gradingStudents' function below. | |
* | |
* The function is expected to return an INTEGER_ARRAY. | |
* The function accepts INTEGER_ARRAY grades as parameter. | |
*/ | |
public static List<int> gradingStudents(List<int> grades) | |
{ | |
return grades.Select(grade=>{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
int[] userInputArray = { 21, 23, 56, 65, 34, 54, 76, 32, 23, 45, 21, 23, 25 } ; | |
int userAskedNumberToBeFind = 23; | |
int segment = 5; | |
var output = "NO"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
int[] userInputArray = { 12, 1234, 45, 67, 1 }; | |
Console.WriteLine(MinimumValue(userInputArray)); | |
Console.WriteLine(MaximumValue(userInputArray)); | |
Console.Read(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
int[] userInputArray = { 104, 5, 99, 100, 45, 102, 67, 1, 3, 2, 9, 105 }; | |
var (minimum, secondMinimum) = MinimumValue(userInputArray); | |
var (maximum, secondMaximum) = MaximumValue(userInputArray); | |
Console.WriteLine($"Minimum: {minimum}, Second Minimum {secondMinimum}"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void solve(double meal_cost, int tip_percent, int tax_percent) | |
{ | |
double tip = (meal_cost /100) * tip_percent; | |
double tax = (meal_cost / 100) * tax_percent; | |
double total_cost = meal_cost + tip + tax; | |
Console.WriteLine(Math.Round(total_cost)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Solution { | |
public int Trap(int[] height) { | |
return GetTotal(height); | |
} | |
private static int GetTotal(int[] height) | |
{ | |
var totalLength = height.Length; | |
var total = 0; | |
for (int i = 0; i < totalLength; i++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Learned theory from https://www.youtube.com/watch?v=HkvChUv9dDg | |
class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var array = new int[] { 19, 10, 12, 10, 24, 25, 22 }; | |
//generate empty array to add values on index | |
// keeping +1 in max to avoid index out error can be handle by other condition though | |
var arrayForOutPut = Enumerable.Repeat(0, array.Max() + 1).ToList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var array = new int[] { 0, 0, 1, 1, 1, 2, 2, 3, 3, 4 }; // 1, 1, 2 | |
var LEFT = 0; | |
var RIGHT = 1; | |
var newIndex = 1; |
OlderNewer