Skip to content

Instantly share code, notes, and snippets.

View aksnell's full-sized avatar
🏠
Working from home

Alex Snell aksnell

🏠
Working from home
  • Walmart Global Tech
  • Bentonville, Arkansas
  • 16:14 (UTC -12:00)
View GitHub Profile
package kata
func ValidParentheses(parens string) bool {
pStack := 0
for _, paren := range parens {
if paren == '(' {
pStack++
} else {
if pStack == 0 {
return false
func hasForwardMatch(target string, index int) bool {
matchStack := 1
for i := index + 1; i < len(target); i++ {
if target[i] == '(' {
matchStack++
} else {
matchStack--
if matchStack == 0 {
return true
}
using System;
using System.Collections.Generic;
public class DnaStrand
{
public static string MakeComplement(string dna)
{
List<char> compliment = new List<char>();
foreach (var nucleo in dna)
using System;
using System.Linq;
public static class Kata
{
public static int DescendingOrder(int num)
{
return int.Parse(string.Join("", num.ToString().OrderByDescending(x => x)));
}
}
using System;
using System.Linq;
public class Kata
{
public static string AbbrevName(string name)
{
return name.ToUpper().Split(" ").Aggregate((first, last) => first[0] + "." + last[0]);
}
}
using System.Linq;
namespace Solution
{
public static class Program
{
public static int findSum(int n)
{
return Enumerable.Range(1, n).Where(x => x % 5 == 0 || x % 3 == 0).Sum();
}
}
using System;
using System.Linq;
public class Kata
{
public static int LargestPairSum(int[] numbers)
{
return numbers.OrderByDescending(x => x).ToArray()[0..2].Sum();
}
}
function dontGiveMeFive(start, end)
{
let count = 0;
for (index = start; index < end + 1; index++) {
if (!index.toString().includes('5')) {
count++;
}
}
return count;
}
const rps = (firstThrow, secondThrow) => {
if (firstThrow === secondThrow) {
return 'Draw!'
}
switch (firstThrow) {
case 'rock':
return (secondThrow === 'scissors') ? 'Player 1 won!' : 'Player 2 won!'
case 'paper':
return (secondThrow === 'rock') ? 'Player 1 won!' : 'Player 2 won!'