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
class Node: | |
def __init__(self,val,next_node=None): | |
self.val=val | |
self.next_node = next_node | |
def remove_all_n(head,n): | |
_head = head | |
while _head and _head.val == n: | |
_head = _head.next_node | |
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
def gcd(a,b): | |
# if a==0: | |
# return b | |
# return gcd(b%a,a) | |
return agcd(a,b) | |
def agcdUtil(a,b,p): | |
if a==0: |
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
class Bit: | |
def __init__(self,a): | |
self.a = a | |
self.n = len(a) | |
self.bit = [0]*(self.n+1) | |
for i,x in enumerate(a): | |
if i == 0 : continue | |
self.update(i,x) | |
def update(self,x,val): |
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> | |
#include<cstring> | |
using namespace std; | |
#define ALPHA_SIZE (26) | |
#define GET_INDEX(c) ((int)c-(int)'a') | |
class Dic | |
{ | |
struct node | |
{ | |
int value; |
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
/* | |
WORDAMENT | |
program | |
{ | |
WAP to search a word in N*N grid with one char in | |
each cell. | |
move direction allow::( vertically,horizontal,diagonal) | |
direction are |
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
/* | |
HIOS@Study material | |
Topic :: Different between | |
1: char s[]=" hios technology "; | |
2: char *s=" hios technology " ; | |
*/ | |
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
/* | |
1) Given a string, you have to check if it is a valid number or not.(The number can be signed, floating point/integer). | |
If it is a number return true else return false. | |
The constraints were :- | |
i) No decision statements allowed (No if-else,no switch-case). | |
ii) No ternary conditional operators allowed (? : not allowed). | |
iii) No looping statements allowed (No for/while/do-while). | |
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> | |
#include <cstring> | |
#include <cmath> | |
using namespace std; | |
bool check(int 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
/* | |
After 2hrs effort I have completed this :) | |
HIOS@PRODUCT | |
CODER# @haikent hitesh | |
-> conert any c /c++ object int binary form (int,float,char,struct data.....) | |
<for gudan> | |
*/ | |
#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
import math | |
import sys | |
import random | |
def log2(n): | |
return math.log(n)/math.log(2) | |
def power(x,y,p): | |
'(x^y)%p' | |
res=1 |
NewerOlder