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
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; | |
} |
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
int[] codefightsTournament(int p, int s) { | |
return new int[] {(int)(Math.pow(0.5,p)*4000),p==1?2*s:s}; | |
} |
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
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){ |
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
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> |
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<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]; |
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
var arr = [03,01,00,170,25,01]; | |
var dem = 00; | |
arr.forEach(function(e) { | |
dem ^= e; | |
}, this); | |
console.log("answer:" + dem.toString(16)); |
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
package com.sunflyelec.smartearphone.module.bluetooth.activity; | |
import android.Manifest; | |
import android.bluetooth.BluetoothAdapter; | |
import android.bluetooth.BluetoothDevice; | |
import android.content.BroadcastReceiver; | |
import android.content.Context; | |
import android.content.DialogInterface; | |
import android.content.Intent; | |
import android.content.IntentFilter; |
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
//Program 1, to reverse strings. | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main(int argc, char *argv[]) //used to accept command line args | |
{ | |
if(argc < 2 ){ //check if there are any inputs in command line | |
printf("please provide inputs"); //if no, exit | |
exit(1); |
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 csv | |
filen = 'full-corpus.csv' | |
with open(filen) as csv_file: | |
reader = csv.reader(csv_file, delimiter=',', quotechar='"') | |
for item in reader: | |
print(item[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
function whatsAppText(t) { | |
window.InputEvent = window.Event || window.InputEvent; | |
var d = new Date(); | |
var event = new InputEvent('input', {bubbles: true}); | |
var textbox = document.querySelector('#main > footer > div.block-compose > div.input-container > div.pluggable-input.pluggable-input-compose > div.pluggable-input-body.copyable-text.selectable-text'); | |
textbox.textContent = t; | |
textbox.dispatchEvent(event); |
OlderNewer