Skip to content

Instantly share code, notes, and snippets.

View hgadre's full-sized avatar

Hrishikesh Gadre hgadre

View GitHub Profile
package org.apache.hadoop.ozone.dn.scrubber;
import org.apache.hadoop.hdds.client.ReplicationFactor;
import org.apache.hadoop.hdds.client.ReplicationType;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
import org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos;
import org.apache.hadoop.hdds.scm.ScmConfigKeys;
import org.apache.hadoop.hdds.scm.container.ContainerID;
import org.apache.hadoop.hdds.scm.container.ContainerInfo;
@hgadre
hgadre / Expressions.java
Last active December 27, 2018 19:14
A program to generate all combinations of well formed brackets for a given number N
package sample;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class Expressions {
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* We have been given a list of strings which are blacklisted. The goal is
import java.io.*;
import java.util.*;
class Solution {
public static void main(String[] args) {
List<String> l = new ArrayList<>();
l.add("world war 3");
l.add("world war 2");
l.add("world war 6");
l.add("world war 9");
/**
* 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
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.time.LocalDateTime;
import javax.security.auth.Subject;
/**
* 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
class LruCache {
static class CacheEntry {
Integer key;
Integer value;
CacheEntry prev, next;
}
Map<Integer, CacheEntry> map = new HashMap<>();
CacheEntry head, tail;
int capacity;