This file contains hidden or 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
| 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)==' ') |
This file contains hidden or 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
| 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; |
This file contains hidden or 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
| 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] == '*') { |
This file contains hidden or 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
| 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; | |
| } |
This file contains hidden or 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 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 |
This file contains hidden or 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
| 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<>(); |
This file contains hidden or 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
| 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(); |
This file contains hidden or 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
| $.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 |
This file contains hidden or 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 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 |
This file contains hidden or 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
| { | |
| "id": 8, | |
| "name": "kdjgkjd", | |
| "longitude": 43.434, | |
| "latitude": 23.4343, | |
| "shortDescription": "k", | |
| "knowMore": "k", | |
| "beforeYouGo": null, | |
| "behindScenes": null, | |
| "duration": null, |