import numpy as np
arr = np.array([np.nan, 2, 3, 4, 5])
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
name = ["abhishek", "abhishek raj", "kumar soun", "raj kumar" "pagla ravi", "simpee singh" ] | |
name.sort(key = lambda nm: nm.sort(" ")[-1]) | |
print name |
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
// Check if a given integer is even or odd. | |
/* | |
n = 5 = 101(binary) | n = 6 = 0110 | |
1 = 001(binary) | 1 = 0001 | |
------------ | -------- | |
& - 001 == 1 (true) | &- 0000 == 0 (false) | |
*/ | |
#include<iostream> | |
using namespace std; |
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<iostream> | |
using namespace std; | |
template <class T> | |
class myvalues { | |
T myval1, myval2; // two value of type T | |
public: | |
myvalues(T arg1, T arg2){ | |
myval1 = arg1; | |
myval2 = arg2; |
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
/* By using a two-dimensional array, write C++ program to display the exact table of numbers that is shown below: | |
################## | |
# 1 2 3 4 5 # | |
# 6 7 8 9 10 # | |
# 11 12 13 14 15 # | |
# 16 17 18 19 20 # | |
# 21 33 23 24 25 # | |
################## | |
*/ |
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
// Sum of Digits Using Recursion | |
#include <iostream> | |
using namespace std; | |
int DigitSum(int); | |
int main() { | |
int num, sum; | |
cout<<"Enter Number to add digit: "; | |
cin>>num; |
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
const {performance} = require('perf_hooks'); | |
const nemo = ['nemo']; | |
const everyone = ['abhishek', 'pagla', 'ravi', 'raj', 'sita', 'gita', 'ram']; | |
const large = new Array(100000).fill('nemo'); | |
function findNemo(array) { | |
let t0 = performance.now(); | |
for (let i = 0; i < array.length; i++) { |
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
// What is the Big O of the below function? (Hint, you may want to go line by line) | |
function anotherFunChallenge(input) { | |
let a = 5; // O(1) | |
let b = 10;// O(1) | |
let c = 50;// O(1) | |
for (let i = 0; i < input; i++) { | |
let x = i + 1; // O(n) | |
let y = i + 2; // O(n) | |
let z = i + 3; // O(n) |
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
// What is the Big O of the below function? (Hint, you may want to go line by line) | |
function funChallenge(input) { | |
let a = 10; // O(1) | |
a = 50 + 3; // O(1) | |
for (let i = 0; i < input.length; i++) { // O(n) here n -> number of input | |
anotherFunction(); // O(n) | |
let stranger = true; // O(n) | |
a++; // O(n) | |
} |
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"> | |
<link href="https://fonts.googleapis.com/css?family=Open+Sans:100,300,400,600" rel="stylesheet" type="text/css"> | |
<link href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css"> | |
<link type="text/css" rel="stylesheet" href="syle.css"> |
NewerOlder