Skip to content

Instantly share code, notes, and snippets.

//time complexity O(nlogn)+ O(n)
//space complexity O(n)
const person1 = [[1000, 1400], [1500, 1700], [1930, 2030]]
const person2 = [[1000, 1200], [1200, 1500], [1800, 2100], [2310, 2340]]
const interval = 50
const breakTime = 10
//expectedOp =[[2110,2200],[2210,2300]]
function findInterval(person1, person2, interval, breakTime) {
let arr = [0, 10, 30, 25, 40, 32, 31, 35, 48, 55];
function sortSubArray(arr) {
let startIndex = 0;
let endIndex = 0;
//find first change in order from left
for (let i = 0; i < arr.length - 1; i++) {
if (!(arr[i] < arr[i + 1])) {
@risabhsharma71
risabhsharma71 / redis_cheatsheet.bash
Created January 1, 2021 13:20 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
package main
import (
"bytes"
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
package main
import (
"bytes"
"encoding/json"
"fmt"
"strings"
"time"
"github.com/hyperledger/fabric/core/chaincode/shim"