Skip to content

Instantly share code, notes, and snippets.

public static void doInsertionSort(int[] arr)
{
for(int i = 1; i < arr.Length; i++)
{
var key = arr[i];
var j = i -1;
while(j>=0 && arr[j] > key)
{
arr[j+1] = arr[j];
public static void doSelectionSort(int[] arr)
{
for (int index = 0; index < arr.Length; index++)
{
var minIndex = index;
var item = arr[index];
for (int j = index; j < arr.Length; j++)
{
if (arr[minIndex] > arr[j])
{
@msiddiqi
msiddiqi / areAnagrams.scala
Created February 16, 2020 20:04
checking if two strings are anagrams
def areAnagrams(first: String, second: String) = {
(first, second) match {
case x if first.length != second.length => false
case _ => {
val firstGroup = first.groupBy(i => i).map { case (item, repetitions) => (item, repetitions.size) }
val secondGroup = second.groupBy(i => i).map { case (item, repetitions) => (item, repetitions.size) }
firstGroup.size == secondGroup.size &&
def getNthFibnacci(n: Int): Int = {
if (n == 0 || n == 1) {
return n
}
return getNthFibnacci(n - 1) + getNthFibnacci(n - 2)
}
print(getNthFibnacci(7))
> sudo ng add @angular/pwa --project angular-pwa
Password:
Installing packages for tooling via npm.
Installed packages for tooling via npm.
CREATE ngsw-config.json (620 bytes)
CREATE src/manifest.webmanifest (1079 bytes)
CREATE src/assets/icons/icon-128x128.png (1253 bytes)
CREATE src/assets/icons/icon-144x144.png (1394 bytes)
CREATE src/assets/icons/icon-152x152.png (1427 bytes)
CREATE src/assets/icons/icon-192x192.png (1790 bytes)
http-server -c-1 dist/angular-pwa
Starting up http-server, serving dist/angular-pwa
Available on:
http://127.0.0.1:8080
http://172.20.10.3:8080
> http-server
Starting up http-server, serving ./
Available on:
http://127.0.0.1:8080
http://172.20.10.3:8080
Hit CTRL-C to stop the server
sudo npm install -g http-server
ng serve
ng new angular-pwa
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? CSS