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
from collections import deque | |
def precedence(op): | |
"""Returns the precedence of an operator.""" | |
if op in "+-": | |
return 1 | |
elif op in "*/": | |
return 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
function isPalindrome(val) { | |
let str = val.toString(); | |
let rev = str.split("").reverse().join(""); | |
return str === rev; | |
} | |
console.log(isPalindrome(129)) | |
function findTriplets(arr) { |
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 net = require("net"); | |
const server = net.createServer(); | |
// Listening to connection event | |
server.on("connection", (ClientToProxySocket) => { | |
console.log("Client connected to the proxy"); | |
ClientToProxySocket.once("data", (data) => { | |
//checking if connection is HTTP or HTTPS | |
let isTLSConnection = data.toString().indexOf("CONNECT") !== -1; |