Skip to content

Instantly share code, notes, and snippets.

View DipanshKhandelwal's full-sized avatar

Dipansh Khandelwal DipanshKhandelwal

View GitHub Profile
@DipanshKhandelwal
DipanshKhandelwal / MongoQueries.md
Last active July 8, 2019 07:59
Data mongo queries

Mongo Queries

[x] a. How many smart contacts does my user have?

[x] b. How many people do they speak to on average?

[x] c. What is the percentage of outgoing calls they make?

[x] d. How much time do they spend on phone calls?

@DipanshKhandelwal
DipanshKhandelwal / ConnectFour_Win_Logic.js
Created April 6, 2019 02:35
An efficient win check for connect four game !!
checkWinner = ({ column, row, board }) => {
// ROW CHECK
for (var i = 0; i < 4; i++) {
if (column - 3 + i >= 0 && column + i < 7) {
if (this.checkLine(
board[column - 3 + i][row],
board[column - 2 + i][row],
board[column - 1 + i][row],
board[column - 0 + i][row],
)) {
@DipanshKhandelwal
DipanshKhandelwal / jacobi_method.py
Created November 21, 2018 05:40
Iterative Solution : Jacobi method
import numpy as np
# Iterative solution
# Jacobi method
def jacobi(A, b, x0, k):
# A = D + L + U
# D is matrix with diagonal elements
# L is lower triangular matrix
# U is upper triangular matrix
#
@DipanshKhandelwal
DipanshKhandelwal / Object Oriented Programming with Dart.dart
Last active April 5, 2018 08:41
Object Oriented Programming with Dart
//Created by Dipansh Khandelwal
// Github @DipanshKhandelwal
import 'dart:math';
abstract class Shape {
List<double> sides;
double perimeter;
Shape(this.sides) {