Skip to content

Instantly share code, notes, and snippets.

View VizShaT's full-sized avatar
🎯
Focusing

Vijay Shankar Gupta VizShaT

🎯
Focusing
View GitHub Profile
@VizShaT
VizShaT / TestCase.js
Last active August 15, 2022 14:37
Calculating with Functions - Kata - Codewars
seven(times(five())); // must return 35
four(plus(nine())); // must return 13
eight(minus(three())); // must return 5
six(dividedBy(two())); // must return 3
@VizShaT
VizShaT / removeVowel.js
Created July 28, 2016 17:27
Remove Vowel from a string - JavaScript
function disemvowel(str) {
return str.replace(/[aeiou]/gi, '');
}
//////////////////////////////
function disemvowel(str) {
var vowels = ['a', 'e', 'i', 'o', 'u'];
return str.split('').filter(function(el) {
@VizShaT
VizShaT / isPerfectSquare.cpp
Created July 26, 2016 17:01
Perfect Square
bool is_perfect_square(int n) {
if (n < 0)
return false;
int root(round(sqrt(n)));
return n == root * root;
}
bool is_perfect_cube(int n) {
int root(round(cbrt(n)));
return n == root * root * root;
@VizShaT
VizShaT / ValidSubString.cpp
Created July 7, 2016 17:16
Length of the longest valid substring
/*
http://ideone.com/rdL7A2
http://www.geeksforgeeks.org/length-of-the-longest-valid-substring/
http://www.practice.geeksforgeeks.org/problem-page.php?pid=960
*/
#include<bits/stdc++.h>
using namespace std;
int validSubString(string str){
@VizShaT
VizShaT / countReversal.cpp
Created July 7, 2016 15:04
Minimum number of bracket reversals needed to make an expression balanced
/*
http://ideone.com/goOdhF
http://www.geeksforgeeks.org/minimum-number-of-bracket-reversals-needed-to-make-an-expression-balanced/
http://www.practice.geeksforgeeks.org/problem-page.php?pid=961
*/
#include <iostream>
#include <string>
#include <stack>
using namespace std;
@VizShaT
VizShaT / NaivePatternSearching.cpp
Created July 6, 2016 10:54
Naive Pattern Searching
/*
http://ideone.com/sqO5WQ
http://www.geeksforgeeks.org/searching-for-patterns-set-1-naive-pattern-searching/
http://www.practice.geeksforgeeks.org/problem-page.php?pid=135
*/
#include <iostream>
#include <string>
#include <vector>
using namespace std;
@VizShaT
VizShaT / ReverseStringSpecial.cpp
Created July 6, 2016 10:22
Reverse an string without affecting special characters
/*
http://ideone.com/hUuU3D
http://www.geeksforgeeks.org/reverse-an-array-without-affecting-special-characters/
http://www.practice.geeksforgeeks.org/problem-page.php?pid=973
*/
#include <iostream>
#include <string>
#include <vector>
using namespace std;
@VizShaT
VizShaT / RemoveSpaces.cpp
Created July 5, 2016 14:02
Remove spaces from a given string - GeekforGeeks
/*
http://ideone.com/fl1XGN
http://www.geeksforgeeks.org/remove-spaces-from-a-given-string/
http://www.practice.geeksforgeeks.org/problem-page.php?pid=454
*/
#include <iostream>
#include <string>
#include <vector>
using namespace std;
@VizShaT
VizShaT / Palindromic-Subsequences.cpp
Created July 5, 2016 12:55
Palindromic Subsequences - GeeksforGeeks
/*
http://ideone.com/oUPCxR
http://www.geeksforgeeks.org/minimum-number-of-palindromic-subsequences-to-be-removed-to-empty-a-binary-string/
http://www.practice.geeksforgeeks.org/problem-page.php?pid=718
*/
#include <iostream>
#include <string>
#include <vector>
using namespace std;