Skip to content

Instantly share code, notes, and snippets.

View ajitjha393's full-sized avatar
πŸ™†β€β™‚οΈ
Phew not sure really!

Bishwajit Jha ajitjha393

πŸ™†β€β™‚οΈ
Phew not sure really!
View GitHub Profile
@ajitjha393
ajitjha393 / README.md
Last active July 7, 2023 15:10
Application Assignment

Full Stack Assignment

Deadline

  • 3 days after the initial commit

Evaluation Pointers

  • A Github repository to maintain the code
  • I'll go through you commit history to figure out your thought process so make sure you write your commits properly
  • The assignment is to test your skill level to what you claim to be so even if you can't complete the assignment completely, it is still fine to submit a half baked version till the deadline so we can at least analyse the code quality.
  • Your initial commit is just going to be a simple README.md file that has our assignment as its content or if using a boilerplate, the boilerplate is the initial commit.
@ajitjha393
ajitjha393 / explain.md
Last active April 28, 2022 13:53
Make Field Require / Optional based on discriminated `type`

Problem Statement

https://stackoverflow.com/a/72041363/10310568

Explanation

So we have this given Node type and the problem statement is that, we need to make props field to be required when the value provided to type = 'entity' and it can be optional for type = 'text'.

export type Node = {
@ajitjha393
ajitjha393 / chainable-ds.md
Last active July 6, 2021 14:34
Chainable Construct

Enable Chaining of Any Type

We might all be familiar with chain syntax of Promises wherein to avoid callback hell we use then and catch methods

Ex:

   fetch('https://...')
   .then(res => log(res.data))
   .catch(err => log(err))
   
'''
Input that I m getting:
c -> list of city name String[]
x -> int[]
y -> int[]
q -> String[]
'''
# Time -> O(n2) , Space -> O(1)
# Heron Area formula = sqrt(s(s-a)(s-b)(s-c))
# where s = (a + b + c) / 2
def calculateArea(s,a,b,c):
return pow(s*(s-a)*(s-b)*(s-c) , 0.5)
def main():
a , b ,c = map(int,input('Enter sides of triangle : ').split(' '))
s = (a + b + c) / 2
@ajitjha393
ajitjha393 / Bfs.py
Created June 11, 2020 10:34
BFS In Python
from collections import defaultdict
class Graph:
# Constructor must be __init__ not _init_
def __init__(self):
print('Hey')
self.graph=defaultdict(list)# specifying what kind of value will each key take
def addEdge(self,u,v):
@ajitjha393
ajitjha393 / Max.py
Created April 24, 2020 14:11
Maximize it ! (Brute for solution )
s1=input().split()
k=int(s1[0])
m=int(s1[1])
M=[[0]]*7
for i in range(k):
s1=input().split()
l=[]
for s in range(len(s1)):
class DOMHelper {
static clearEventListeners(element) {
const clonedElement = element.cloneNode(true);
element.replaceWith(clonedElement);
return clonedElement;
}
static moveElement(elementId, newDestinationSelector) {
const element = document.getElementById(elementId);
const destinationElement = document.querySelector(newDestinationSelector);