View NumberOfIslands.java
/** | |
* Given a matrix of 0 and 1, where 0 represents water and 1 represent land. | |
* Two pieces of land are connected if they are touching each other(vertical, horizontal or diagonal) | |
* Please write a method that counts the number of islands. | |
* | |
* Here is an example : | |
* 0 (1 1) 0 0 0 [1] | |
* 0 (1) 0 0 [1 1] 0 | |
* 0 (1 1) 0 0 [1] 0 | |
* 0 0 0 0 0 0 0 |
View SimpleRxJava2Test.java
package com.emirates; | |
import static org.hamcrest.CoreMatchers.hasItem; | |
import static org.hamcrest.CoreMatchers.hasItems; | |
import static org.hamcrest.CoreMatchers.notNullValue; | |
import static org.junit.Assert.assertEquals; | |
import static org.junit.Assert.assertThat; | |
import io.reactivex.Observable; | |
import io.reactivex.observers.TestObserver; |
View recursivePermutations.java
package com.jiahaoliuliu.tools; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.stream.Collectors; | |
public class Permutations<T> { | |
private List<List<T>> generatePermutations(List<T> seedLists) { | |
return generatePermutations(new ArrayList<>(), seedLists); |
View ListSplitterSum
package com.jiahaoliuilu.testing.toptal; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
public class Test1 { | |
// Testing array | |
private static int[] array = {5, 5, 1, 7, 2, 3, 5}; |
View SudokuChecker.java
package com.jiahaoliuliu.sudokuchecker; | |
import java.util.ArrayList; | |
import java.util.HashSet; | |
import java.util.Set; | |
/** | |
* A class to check the if the content of a Sudoku is correct or not. The complexity of the algorithm | |
* has been kept to O(N^2), instead of O(N^3) for the cube check. | |
* |
View SimpleCursorLoader.java
/* | |
* Copyright 2012 CodeSlap - Cristian Castiblanco | |
* Modified by Jiahao Liu jiahaoliuliu@gmail.com | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* |
View ExportSQLite.grt.lua
-- ExportSQLite: SQLite export plugin for MySQL Workbench | |
-- Copyright (C) 2009 Thomas Henlich | |
-- | |
-- This program is free software: you can redistribute it and/or modify | |
-- it under the terms of the GNU General Public License as published by | |
-- the Free Software Foundation, either version 3 of the License, or | |
-- (at your option) any later version. | |
-- | |
-- This program is distributed in the hope that it will be useful, | |
-- but WITHOUT ANY WARRANTY; without even the implied warranty of |