Skip to content

Instantly share code, notes, and snippets.

/**
* @param {number[]} nums
* @return {number}
*/
var maxSubArray = function (nums) {
var start = 0;
var next = start + 1;
var sum1 = 0;
var sum2 = 0;
var max;
'use strict';
/**************************************************************************************************
* This sample demonstrates a few more advanced features of Swagger-Express-Middleware,
* such as setting a few options, initializing the mock data store, and adding custom middleware logic.
**************************************************************************************************/
// Set the DEBUG environment variable to enable debug output of Swagger Middleware AND Swagger Parser
process.env.DEBUG = 'swagger:*';
var util = require('util'),
app.use(function(req, res,next){
var caller = req.connection.remoteAddress; //Will give you the request IP Address
next();
});
@RameshRM
RameshRM / fb-initial
Last active September 27, 2016 18:50
// Given an input string, and an alphabet, find the shortest substring in the input containing every letter in the alphabet at least once
// “aaccbc”, {‘a’, ‘b’, ‘c’} => “accb"
// "aaaabbbcccdddcdba", [ 'a', 'b', 'c' ] => cdba
for (var i = 0; i < input.length; i++) {
for (var j = i; j < input.length; j++) {
var s = input.substring(i,j);
'use strict';
var input = 'this is a test string';
input = 'aaaabbbcccdddcdbaaa';
var match = 'tist'; //accb
match = 'abc';
input = 'abcdefadfafaefd';
match = 'ef';
var matches = [];
'use strict';
var input = 'cbabadcbbabbcbabaabccbabc';
var match = 'abbc';
var matches = [];
var weight = getWeight('abad');
var result = [];
for (var i = 0; i < input.length; i++) {
if (getWeight(input.substr(i, match.length)) === weight) {
public class TestSum {
public static void main(String[] args) {
List<Integer> inputNumbers = new ArrayList<Integer>();
inputNumbers.add(3);
inputNumbers.add(4);
inputNumbers.add(6);
inputNumbers.add(2);
inputNumbers.add(5);
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
pin_to_circuit=7
GPIO.setup(pin_to_circuit, GPIO.OUT)
Start Fresh:
Step 1:
docker pull ramesh1211/optimus:c453d919e443
Step 2: //Stop any existing Docker Processees.
docker stop $(docker ps)
Step3:
docker run -d -p 8009:8080 f914f44dbcc2
// _Channels_ are the pipes that connect concurrent
// goroutines. You can send values into channels from one
// goroutine and receive those values into another
// goroutine.
package main
import "bufio"
import "fmt"
import "net"