Skip to content

Instantly share code, notes, and snippets.

View jaideepheer's full-sized avatar
🕹️

Jaideep Singh Heer jaideepheer

🕹️
View GitHub Profile
#include<iostream>
#include<algorithm>
typedef long long ULL;
#define MOD_BASE (ULL)1000000007 // NOTE: This is a prime number.
using namespace std;
template<class T>
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int T;
cin>>T;
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int main()
{
static int LETTER[28] = {0};
int T;
T = int(input())
while(T>0):
T-=1
inp = input()
prevRange = 0
dist = 55 # max dist. (=infinity) for first robot
collision = False
# iterate through input string
for c in inp:
/**
* Question found here: https://www.codechef.com/OCT18B/problems/MINDSUM
*
* You are given positive integers N and D.
* You may perform operations of the following two types:
* add D to N, i.e. change N to N+D
* change N to digitsum(N)
* Here, digitsum(x) is the sum of decimal digits of x.
* For example, digitsum(123)=1+2+3=6 and digitsum(100)=1+0+0=1.
*
@jaideepheer
jaideepheer / InferenceAI.py
Created September 18, 2018 11:07
Inference AI // 01
# define knowledge base
class knowledgeBase:
class mappingIterator:
def __init__(self, key, mappings):
self.mappings = mappings
self.key = key
self.maxlevel = 0
self.curlevel = -1
self.isEmpty = not key in mappings
if self.isEmpty:
@jaideepheer
jaideepheer / B.sums of sums. try 2.using vector[Incorrect].cpp
Last active August 15, 2018 19:19
codejam.kickstart.2018.practice-B.sum.of.sums[Incorrect].cpp
#include<iostream>
#include<string.h>
#include<vector>
#include<algorithm>
using namespace std;
#define MAXN 200000
int numarray[MAXN];
vector<long long> sums;
@jaideepheer
jaideepheer / arduinoSerialBasic.cpp
Created August 4, 2018 17:32
snailyArduinoProg.
char data = 0;
bool flip = true;
void setup()
{
Serial.begin(9600); //Sets the data rate in bits per second (baud) for serial data transmission
pinMode(13, OUTPUT); //Sets digital pin 13 as output pin
}
void loop()
{
if(Serial.available() > 0) // Send data only when you receive data:
@jaideepheer
jaideepheer / snailyProg.py
Last active September 12, 2020 09:54
Write a program that repeatedly prompts a user for integer numbers untill the user enters 'done'. Once 'done' is entered print out the largest and smallest of the numbers. If user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. Enter 7, 2, bob, 10 and 4 and match the …
"""
Write a program that repeatedly prompts a user for integer numbers untill the user enters 'done'.
Once 'done' is entered print out the largest and smallest of the numbers.
If user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number.
Enter 7, 2, bob, 10 and 4 and match the output.
Invalid input
Maximum is 10
Minimum is 2
"""