Skip to content

Instantly share code, notes, and snippets.

View vaibhav93's full-sized avatar

Vaibhav Bansal vaibhav93

  • Amherst, Massachusetts
View GitHub Profile
class Solution {
public int myAtoi(String str) {
if(str.length()==0)
return 0;
int sign = 1;
int i =0;
int base=0;
while(str.charAt(i)==' ')
class Solution {
public String minWindow(String s, String t) {
if(s.length()<t.length())
return "";
int[] sChars = new int[256];
int[] tChars = new int[256];
int count = 0;
int start = 0;
int minLength = Integer.MAX_VALUE;
class Solution {
public boolean isMatch(String s, String p) {
char[] text = s.toCharArray();
char[] pattern = p.toCharArray();
boolean T[][] = new boolean[text.length + 1][pattern.length + 1];
T[0][0] = true;
//Deals with patterns like a* or a*b* or a*b*c*
for (int i = 1; i < T[0].length; i++) {
if (pattern[i-1] == '*') {
class Solution {
public boolean isMatch(String s, String p) {
int m=s.length(), n=p.length();
boolean[][] dp = new boolean[m+1][n+1];
dp[0][0] = true;
//whole column false
for (int i=1; i<=m; i++) {
dp[i][0] = false;
}
import java.io.*;
import java.util.*;
/*
* To execute Java, please define "static void main" on a class
* named Solution.
*
* If you need more classes, simply define them inline.
* Example
* Vaibhav is a Graduate Student
class Solution {
public int ladderLength(String beginWord, String endWord, List<String> wordList) {
//BFS Queue
Queue<Word> bfsQ = new LinkedList<>();
//Initialize BFS
bfsQ.offer(new Word(beginWord,1));
//HashSet to log visited words
HashSet<String> visited = new HashSet<>();
const express = require('express')
var MongoClient = require('mongodb').MongoClient,
var url = 'mongodb://localhost:27017/test';
const db = null
MongoClient.connect(url, function(err, database) {
if(err)
console.log("Error connecting to database");
db = database;
});
const app = express();
$.getJSON('http://stackxchange.info/getData/tags', function (data) {
var dataArray = data.counts;
var tags = data.tags;
console.log(data);
Highcharts.chart('container', {
chart: {
type: 'spline',
parallelCoordinates: true,
parallelAxes: {
lineWidth: 2
var Kafka = require('node-rdkafka');
var producer = require('./producer');
var consumer = new Kafka.KafkaConsumer({
//'debug': 'all',
'metadata.broker.list': 'gc-mskafka1002.pp-devqa-ms-thirdparty.us-central1.gcp.dev.paypalinc.com:9092',
'group.id': 'node-rdkafka-consumer-flow-example',
'enable.auto.commit': false,
'socket.keepalive.enable': true,
'reconnect.backoff.jitter.ms': 500
@vaibhav93
vaibhav93 / response.json
Created July 28, 2018 18:47
acitvity response
{
"id": 8,
"name": "kdjgkjd",
"longitude": 43.434,
"latitude": 23.4343,
"shortDescription": "k",
"knowMore": "k",
"beforeYouGo": null,
"behindScenes": null,
"duration": null,