Skip to content

Instantly share code, notes, and snippets.

View aaayushsingh's full-sized avatar

Ayush Singh aaayushsingh

View GitHub Profile
@aaayushsingh
aaayushsingh / hexor.js
Created July 24, 2017 09:11
Gets hexor for the array, init array dynamically when using. {N}, Helfis
var arr = [03,01,00,170,25,01];
var dem = 00;
arr.forEach(function(e) {
dem ^= e;
}, this);
console.log("answer:" + dem.toString(16));
@aaayushsingh
aaayushsingh / phonebook.c
Last active July 5, 2017 19:09
phonebook using linked list for mayank
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<malloc.h>
#include<string.h>
struct entry{
char name[50];
char nick[50];
char email[50];
log
$ heroku local
[WARN] No ENV file found
11:01:03 AM web.1 | Your server is now running...
11:01:03 AM web.1 | 5000
11:01:07 AM web.1 | GET request received at /
11:01:09 AM web.1 | <!DOCTYPE html>
11:01:09 AM web.1 | <html>
11:01:09 AM web.1 | <head>
app.get('/',function(req,res){
console.log(req.method+" request received at "+req.url);
request({
url:"https://sc.productrx.com/public/",
method:"GET",
qs:{resource:"schema",data_type:"JSON"}
},function(err,response,body){
int[] codefightsTournament(int p, int s) {
return new int[] {(int)(Math.pow(0.5,p)*4000),p==1?2*s:s};
}
int countSumOfTwoRepresentations2(int n, int l, int r) {
if (l==r){ return l*2==n?1:0;}
int c = r-n/2 >= n/2-l ? l: r;
if (n/2<=l||n/2>=r) return 0;
int t=0;
if(n%2==0) t=1;
return Math.abs(n/2-c)+t;
}