Keybase proof
I hereby claim:
- I am adeekshith on github.
- I am adeekshith (https://keybase.io/adeekshith) on keybase.
- I have a public key ASDaFYYNIw727fCxfwv9n9rKdpw8eTJcPUGzxQe1uZ2QuQo
To claim this, I am signing this object:
class Solution { | |
public int maxProfit(int[] prices) { | |
int maxProfit = 0; | |
int prevBuy = Integer.MAX_VALUE; | |
int maxSellPrice = Integer.MIN_VALUE; | |
for (int buyDay=0; buyDay < prices.length; buyDay++) { | |
int buyPrice = prices[buyDay]; | |
if (buyPrice >= prevBuy && maxSellPrice >= buyPrice) { | |
continue; | |
} |
#!/bin/bash | |
# | |
# Self-contained command line processing in bash that supports the | |
# minimal, lowest common denominator compatibility of flag parsing. | |
# -u: undefined variables is an error | |
# -e: exit shell on error | |
set -eu | |
function usage() { |
I hereby claim:
To claim this, I am signing this object:
{ | |
"application" : { | |
"name" : "Custom Search", | |
"app_id" : "custom-search@deekshith.in", | |
"version" : "v0.1" | |
}, | |
"search_engines" : [ | |
{ | |
"category": "General", | |
"name": "DuckDuckGo", |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.ListIterator; | |
public class IntegerTest { | |
public static void main(String[] args) { | |
long startTime; | |
long duration; | |
long endTime; |
# <type>: (If applied, this commit will...) <subject> (Max 50 char) | |
# |<---- Using a Maximum Of 50 Characters ---->| | |
# Explain why this change is being made | |
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->| | |
# Provide links or keys to any relevant tickets, articles or other resources | |
# Example: Github issue #23 |
#!/bin/bash | |
lineNum=1 | |
while IFS='' read -r line || [[ -n "$line" ]]; do | |
echo "Processing line $lineNum : $line" | |
curl -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3" $line -o scraped-html/$lineNum.html | |
delayNow=$((RANDOM%10*30+RANDOM%10)) | |
echo "Waiting for $delayNow sec" | |
sleep $delayNow | |
lineNum=$((lineNum+1)) | |
done < "$1" |
(* Monitors given website load time and plots it *) | |
dataLength = 400; | |
timeTakenUrlReq := | |
First@AbsoluteTiming[Import["http://google.com/"]]; | |
timeTakenTime := {DateList[], timeTakenUrlReq}; | |
data = {timeTakenTime}; | |
Dynamic[Last[AppendTo[data, timeTakenTime]], UpdateInterval -> 10, | |
TrackedSymbols -> {}] | |
Dynamic[If[Length[data] < dataLength, Length[data = data], | |
Length[data = data[[-dataLength ;;]]]]] |
(* Gets JSON from a URL and extracts the data *) | |
(* Gets response in JSON format *) | |
apiResponse1 = Import["http://****shod.com/logdata/dessfaa/predictlocation", "JSON"]; | |
(* Check returns 0 if an error occurs and Quiet supresses displaying errors *) | |
Quiet@Check[apiResponse1, 0] | |
(* Get response from JSON hierarchically *) | |
"latitude" /. ("prediction" /. apiResponse1) | |
(* latitude and prediction are the data keys in the JSON *) |
(* Function overloading in Mathematica *) | |
SumMultiply[x_?NumericQ, y_Real] := | |
Module[ | |
{sum, mul}, | |
sum = x + y; | |
mul = x y; | |
{sum, mul} | |
] | |
SumMultiply[x_Integer, y_Real] := | |
Module[ |