Skip to content

Instantly share code, notes, and snippets.

View vijayparashar12's full-sized avatar

Vijay Parashar vijayparashar12

View GitHub Profile
@vijayparashar12
vijayparashar12 / Solution.java
Created March 20, 2019 22:11
Find the smallest perfect square root of a given range.
public static class Solution {
public static void main(String[] args) {
int a = 6000, b = 7000;
// int a = 10, b = 20;
// int a = 8, b = 24;
int smallestPerfect = getSmallestPerfectSqrt(a, b);
System.out.println(stepsToSmallestSqrt(smallestPerfect));
}
@vijayparashar12
vijayparashar12 / Solution.java
Last active March 14, 2019 20:56
Find the smallest number to given Integer with same number of digits: smallestNumber(125) = 100 , smallestNumber(10) = 10
public class Solution {
public static int smallestNumber(int num) {
int count = 0;
while (num > 0) {
num = num / 10;
count++;
}
return (int) Math.pow(10, count - 1);
}
}
@vijayparashar12
vijayparashar12 / PostgresJSONBBinding.java
Created March 11, 2019 15:18
Supporting PostgreSQL JSON types in jOOQ using Jackson
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import org.jooq.*;
import org.jooq.impl.DSL;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
package de.zalando.ale.serviceclient.outboundpath.domain;
import com.google.common.collect.ImmutableMap;
import de.zalando.ale.serviceclient.outboundpath.domain.chain.ChainPickListPaths;
import de.zalando.ale.serviceclient.outboundpath.domain.enumeration.ShipperType;
public class OutboundPathToShipperTypeMapper {
private static ImmutableMap<String, ShipperType> shipperTypeMap = null;
package hackerrank.pairs
/**
* Created by vparashar on 27/01/2017.
*/
object PairWithDifference {
def main(args: Array[String]) {
val sc = new java.util.Scanner(System.in)
val n = sc.nextInt()
package hackerrank
/**
* Created by vparashar on 26/01/2017.
*/
object Solution {
def main(args: Array[String]): Unit = {
val a = Seq(2, 4)
val b = Seq(16, 32, 96)
println(countBetween(a, b))