This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Write a program which takes an Sorted Array [ 1,2,3,4,6,6,6,7,8,99,99,99,1000] | |
// and removed duplicates. http://share.linqpad.net/sbrxsw.linq | |
// IDEA :: The idea here is to push the elements to the Left, so that all the unique elements are to the left of the array. | |
// When the elements dont match, you swap the places with the last unique element. | |
// When they match just move to next element. | |
void Main() | |
{ | |
// [i/p] : [1,1,1,1] [o/p] : [1,1,1,1] and n=1 | |
// [i/p] : [0] [o/p] : [0] and n=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
import os.path | |
from os import path | |
import requests | |
import shutil | |
class UwCourse(): | |
def __init__(self, courseName, destinationpath=""): | |
self.courseName = courseName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPREAD OPERATOR | |
x = [1,2,3,4,5,6,7] | |
y = [8,9,10] | |
xAndy = [...x, ...y] | |
console.log("SPREAD OPERATOR", xAndy) | |
// REST OPERATOR | |
function test(...b){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
MyClass t = new MyClass() | |
{ | |
MyProperty = 1, | |
MyProperty1 = "YAHOO" | |
}; | |
Console.WriteLine(GetPropertyValue(() => t.MyProperty1)); | |
Console.WriteLine(GetPropertyValue(() => t.MyProperty)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define other methods, classes and namespaces here | |
public static class Maybe | |
{ | |
public static TResult With<TInput, TResult>(this TInput o, Func<TInput, TResult> evaluator) | |
where TResult : class | |
where TInput : class | |
{ | |
if (o == null) return null; | |
else return evaluator(o); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @DtTable TABLE | |
( | |
PolicyInceptionFromDate DATETIME NOT NULL, | |
PolicyInceptionToDate DATETIME NOT NULL, | |
ValuationDate DATETIME NOT NULL | |
) | |
DECLARE @START INT = 0; | |
DECLARE @ValuationDate DATETIME = '12/31/2019'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bubble Sort is O(N^2) since there are 2 nested loops. | |
// Issues :: Slow and no of Swaps are more. | |
let arr = [1,2,4,5,6,7,8,10.5,10]; | |
function bubbleSort(arr) { | |
for (let i = 0; i < arr.length; i++) { | |
let isSorted = false; | |
for (let j = 0; j < arr.length - i - 1; j++) { | |
console.log(`Comparing ${j} with ${j+1}`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Helper Method Recursion Pattern... (Nested Functions) | |
// You are collecting or Creating a subarray :: in such cases Helper Method Recursion comes in handy! | |
function FindAllOddNumbers(arr){ | |
let oddNumbers = []; | |
function getOddNumbers(arr) { | |
if (arr.length === 0) { |