Skip to content

Instantly share code, notes, and snippets.

View nageshwar521's full-sized avatar
✈️
Working from office

Nageshwar Reddy Pandem nageshwar521

✈️
Working from office
View GitHub Profile
@nageshwar521
nageshwar521 / index.html
Created October 7, 2018 02:20
JS Bin JavaScript Bubble Sort Algorithm // source https://jsbin.com/revorur
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="JavaScript Bubble Sort Algorithm">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
@nageshwar521
nageshwar521 / .vimrc
Created December 9, 2017 09:33 — forked from joegoggins/.vimrc
Mac Vim .vimrc file
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" ================ General Config ====================
set number "Line numbers are good
set backspace=indent,eol,start "Allow backspace in insert mode
set history=1000 "Store lots of :cmdline history
set showcmd "Show incomplete cmds down the bottom
@nageshwar521
nageshwar521 / Finding the missing numbers in an array
Created March 3, 2017 09:36
finding the missing numbers in an array, it will format the missed numbers in range format and also it will ignore if the element is not a number
function missingNumbers(nums) {
var missedNums = [];
var sortedArr = nums.sort(function(a, b) {
return a - b;
});
sortedArr.forEach(function(ele, i, arr) {
var a = +arr[i],
b = +arr[i + 1];
if (!b) return;
if (isNaN(b)) {
@nageshwar521
nageshwar521 / duplicate_elements_in_array.js
Last active June 24, 2016 11:01
Easiest way to find duplicate values in a JavaScript array
var dupEleArr = [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 20, 3, 3, 3, 32, 324, 5, 52];
/*
Sort the given array and filter the array by checking
If two adjucent elements are equal and then the next immediate
element should not be equal...
Note: Tested with array of numbers, Not tested with strings
*/
var dupEle = dupEleArr.sort().filter(function(ele,i,arr){
return arr.length > 3 ? (arr[i] == arr[i+1] && arr[i+1] != arr[i+2]) : (arr.length == 2) ? (arr[i] == arr[i+1]) : true;