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
function minimumMoves(arr1, arr2) { | |
if (arr1.length != arr2.length) { | |
return 0; | |
} | |
let moves = 0; | |
arr1.map((elem, index) => { | |
let tempElemArr1 = elem.toString().split('') | |
let tempElemArr2 = arr2[index].toString().split(''); | |
tempElemArr1.map((num, index2) =>{ |
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
from PyPDF2 import PdfFileReader, PdfFileWriter | |
output = PdfFileWriter() | |
input_pdf = PdfFileReader(open('./pdf/super.pdf', 'rb')) | |
watermark_pdf = PdfFileReader(open('./pdf/wtr.pdf', 'rb')) | |
watermark = watermark_pdf.getPage(0) | |
for i in range(input_pdf.getNumPages()): |
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 | |
from PIL import Image | |
# Run the script with: python JPGtoPNGConverter.py source_folder/ destination_folder/ | |
# Grab 2 arguments | |
try: | |
source_folder = sys.argv[1] | |
destination_folder = sys.argv[2] |
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
from random import randint | |
import sys | |
try: | |
min_num = int(sys.argv[1]) | |
max_num = int(sys.argv[2]) | |
if min_num >= max_num: | |
print(f'Input Minimum: {min_num} Maximum: {max_num} NOT VALID.') | |
print('Minimum value should be less than maximum value!') |
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
# HEAD~4 where 4 is the number of commits that will be squashed | |
git reset --soft HEAD~4 && git commit -m "One message for new commit" |
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
package main | |
import ( | |
"fmt" | |
"time" | |
"strconv" | |
) | |
func main() { | |
fmt.Printf("%+v %T\n",time.Now(),time.Now()) |
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
let a1 = [123, 543]; | |
let a2 = [321, 279]; | |
function solution(arr1, arr2) { | |
let sum = 0; | |
let digits = 0; | |
arr1.map((num, i) => { | |
// convert each number to array of string - for each digit | |
// ["1", "2", "3"] | |
digitsArr1 = (""+num).split(""); |
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
function solution(s){ | |
let i = 0; | |
while(i <= s.length) { | |
if (s.includes("AB")) | |
s = s.replace("AB", ""); | |
else if (s.includes("BA")) | |
s = s.replace("BA", ""); | |
else if (s.includes("CD")) | |
s = s.replace("CD", ""); | |
else if (s.includes("DC", "")) |
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
#include<stdio.h> | |
#include<stdlib.h> | |
// QUEUE | |
struct Node { | |
int data; | |
struct Node *next; | |
} *front = NULL, *rear = NULL; | |
void enqueue(int value) { |
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
#include<stdio.h> | |
void ShellSort(int A[], int n) { | |
int gap, i , j, temp; | |
for (gap = n/2; gap >= 1; gap /= 2) { | |
for (i = gap; i < n; ++i) { | |
temp = A[i]; | |
j = i - gap; | |
while (j >= 0 && A[j] > temp) { |