Skip to content

A library of different coding challenges questions and solutions

Notifications You must be signed in to change notification settings

kooixh/coding-challenges

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Coding-Challenges

A series of coding challenges questions and solution in various topics

Feel free to add new questions and solution to the project

Dependencies

Instructions

  1. Write your question in the appropriate docstring before the implementation method.

Example

/**
  *
  * Given an m x n 2d grid map of '1's (land) and '0's (water), return the number of islands.
  *
  * An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically.
  *
  * Ref: https://leetcode.com/problems/number-of-islands/
  */
public int numberOfIslands(int[][] map) {
}       
  1. Create a Test class suffixed with "XxxTest" to test the implementation, this will be run automatically.
  2. Write a test method for the solution prefixed with "testXXX", this prefix is needed for the test to be run automatically.
  3. Make sure tests pass by calling the verify result method.

Example

static void testNumberOfIsland() {
    int[][] map1 = {{1, 1, 1, 1, 0}, {1, 1, 0, 1, 0}, {1, 1, 0, 0, 0}, {0, 0, 0, 0, 0}};
    int expected1 = 1;
    int actual1 = graphSolution.numberOfIslands(map1);
    System.out.print("test 1: ");
    verify(expected1, actual1);
}

Feel free to improve any existing solutions

About

A library of different coding challenges questions and solutions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages