Ad

The Tower of Hanoi is a mathematical puzzle. It consists of three poles and a number of disks of different sizes which can slide onto any poles. The puzzle starts with the disk in a neat stack in ascending order of size in one pole, the smallest at the top thus making a conical shape. The objective of the puzzle is to move all the disks from one pole (say ‘source pole’) to another pole (say ‘destination pole’) with the help of the third pole (say auxiliary pole).

The puzzle has the following two rules:
1. You can’t place a larger disk onto a smaller disk
2. Only one disk can be moved at a time

https://en.wikipedia.org/wiki/Tower_of_Hanoi

using System.Collections.Generic;
using System.Diagnostics;

public class TowerOfHanoi
{
    public static int Tower(int numOfDisks)
    {
        return 0;
    }

    private static int Tower(int n, string source, string aux, string dest, Dictionary<int, int> cache)
    {
        return 0;
    }

}
// Write a project that demonstrates inheritance in C#

Description:
Given an expression as a string, calculate its value. For example, given the string "1+2+3", return 6.

Order of operations should be respected: multiplication happens before addition.

Possible avenues for future exploration:

Adding support for subtraction and division
Stripping whitespace
Adding support for brackets

using System;
using System.Linq;

public class ArtihmeticParser
{
  public static int Evaluate(string input)
  {
    return input.Split("+").Select(EvaluateProduct).Aggregate(0,(a,b) => a+b);
  }
  
  private static int EvaluateProduct(string input)
  {
    return input.Split("*").Select(EvaluateInteger).Aggregate(1,(a,b) => a*b);
  }
  
  private static int EvaluateInteger(string input)
  {
    return int.Parse(input);
  }
}

Description:
Your task is to remove every third char in a string,
using a zero based index

Example:

removeEverySecond('hello world'); // 'heloword'
removeEverySecond('how you doing') // 'howyoudoin'

function removeEveryThird(str) {
  // Remove the third character from every work in the string
  // using a zero based index
  return 'heloword';
}
public class FizzBuzz
{
    public string GetOutput(int number) {
      // Fizz buzz is a popular computer science interview question.  
      // The function above is given a number - if the number is
      // divisible by 3, return "fizz", if it's divisible by 5, 
      // return "buzz", if not divisble by 3 or 5 - return the
      // number itself.
      return "0";
    }
}
function find_unique_items(array1, array2) 
{
  //Find the unique elements from two arrays
  return [1,2,4,6,8]
}
const parse = (value = '') => {
  // if valid email, return true, else return false
  return true;
}
public class Kata {
  public static boolean[] populateBathroom(boolean[] urinals, int numOfPeople) {
    // Implement the urinal problem, described as "given x number of people walking 
    // into a bathroom that contains y number of urinals, describe the optimate
    // placement of people so that none is standing next to the other"
    // In this case, the urinals are represented by a boolean array with 
    // true representing a person at a urinal, and false meaning the urinal is empty
    return new boolean[] {true, false, true};
  }
}
function prime_checker (n) {
  // Write a javascript function to check if N is a prime number
}

// Detect whether this string is a palindrome

public class Kata {
  public static boolean detectPalindrome(String userWord) {
    // Detect whether this string is a palindrome
    return true;
  }
}

Find the max number of times an integer occurs in an array.

import java.util.Arrays;

class MaxOccurence {

  
  public static int findMax(int[] nums) {

      
      return 5;
  }
}

// Change min and max below to be the highest and lowest values
// in the nums array provided to the function

interface HighLow {
    static int[] findLargestAndSmallest(int[] nums) {
        // Change min and max below to be the highest and lowest values
        // in the nums array provided to the function
        int min = 0;  
        int max = 100;
        return new int[]{min, max};
    }
}
import static java.util.stream.DoubleStream.of;
import static org.apache.commons.lang3.ArrayUtils.reverse;

interface DeleteDuplicates {
  static double[] deleteDups(double[] a) {
     // Given an array, eliminate duplicate values and return the array 
     return a;
  }
}
public class Kata {
    public static int findMax(int[] my_array) {
        // Write a method that returns the largest integer in the list.
        // You can assume that the list has at least one element.
        return 7;
    }
}
Loading more items...