{{ message }}

Instantly share code, notes, and snippets.

🏠
Working from home

Atonamy atonamy

🏠
Working from home
• Singapore
Last active Aug 24, 2021
Find the the longest common substrings
View LCS.kt
 /* Solution to this problem https://www.geeksforgeeks.org/print-longest-common-substring/ extended version time complexity O(m*n) */ data class Str(val string: StringBuilder, var startPosition: Int, var nextPosition: Int = startPosition+1, val id: String = UUID.randomUUID().toString() )
Created Jun 6, 2021
2D Metaballs implementation in Godot
View Metaballs.gd
 #based on this article http://jamie-wong.com/2014/08/19/metaballs-and-marching-squares/ extends Node2D class Blob: var pos_x var pos_y var radius var velocity
Created Apr 16, 2020
Technical test for Igloohome
View CaesarCipher.kt
 fun CaesarCipher(str: String, num: Int): String { val result = StringBuilder() for(i in str.indices) { if(str[i].toLowerCase() in 'a'..'z') { val a = 'a'.toLong() val A = 'A'.toLong() val shift = (str[i] + num).toLong() val letterLower = shift - a val letterUpper = shift - A val lower = ('z' + 1).toLong() - a
Last active Jul 5, 2021
[Coderbyte] Technical test for NTUC Singapore (Android Engineer)
View Java REST GET Simple.java
 /* Java REST GET Simple In the Java file, write a program to perform a GET request on the route: https://coderbyte.com/api/challenges/json/rest-get-simple and then print to the console the hobbies property in the following format: ITEM1, ITEM2, ...
Last active Sep 23, 2021
[Coderbyte] Technical test for NTUC Singapore (Android Engineer)
View SeatingStudents.kt
 /* Challenge Have the function SeatingStudents(arr) read the array of integers stored in arr which will be in the following format: [K, r1, r2, r3, ...] where K represents the number of desks in a classroom, and the rest of the integers in the array will be in sorted order and will represent the desks that are already occupied. All of the desks will be arranged in 2 columns, where desk #1 is at the top left, desk #2 is at the top right, desk #3 is below #1, desk #4 is below #2, etc. Your program should return the number of ways 2 students can be seated next to each other. This means 1 student is on the left and 1 student on the right, or 1 student is directly above or below the other student. For example: if arr is [12, 2, 6, 7, 11] then this classrooms looks like the following diagram:
Last active Apr 13, 2020
[Coderbyte] Technical test for NTUC Singapore (Android Engineer)
View BitmapHoles.kt
 /* Using the Kotlin language, have the function BitmapHoles(strArr: Array): String take the array of strings stored in strArr, which will be a 2D matrix of 0 and 1's, and determine how many holes, or contiguous regions of 0's, exist in the matrix. A contiguous region is one where there is a connected group of 0's going in one or more of four directions: up, down, left, or right. For example: if strArr is ["10111", "10101", "11101", "11111"], then this looks like the following matrix: 1 0 1 1 1
Created Aug 3, 2019
View maxDifference.kt
 fun maxDifference(arr: Array): Int { var min: Pair = Pair(0, 0) var max: Pair = Pair(0, 0) var result = -1 for(i in 0 until arr.size) { when { i == 0 -> { min = Pair(i, arr[i])
Created May 21, 2019 — forked from patrickhammond/gist:0b13ec35160af758d98c
Sample for how to use the Google Play Services dynamic security provider to keep the SSL library that the app will use to up date.