Skip to content

Instantly share code, notes, and snippets.

View shaswatsaxena's full-sized avatar
🎯
Focusing

Shaswat Saxena shaswatsaxena

🎯
Focusing
View GitHub Profile
@shaswatsaxena
shaswatsaxena / minMovesPaperFolding.js
Created July 1, 2019 05:58
Paper Folding in minimum moves
function minMoves (h,w,h1,w1) {
let moves = 0;
while (h != h1 || w != w1){
moves++;
if ( h > h1 ) {
let hFold = h - h1;
if (hFold > Math.floor(h/2)) {
hFold = Math.floor(h/2);
}
h = h - hFold;