Monthly Archives: May 2018

Convert List to an Array and Array to List Java

List<Integer> list = Arrays.stream(nums).boxed().collect(Collectors.toList()).stream().distinct().collect(Collectors.toList()); where nums is an int []   list.stream().mapToInt(i->i).toArray(); which returns int[] Advertisements

Posted in Uncategorized | Leave a comment

Divide Two Integers

https://leetcode.com/problems/divide-two-integers/description/ package src.test.java.examples;package src.test.java.examples; public class Dividend { public int divide(int dividend, int divisor) { int count = 0; boolean flag = false; if (dividend < 0 && divisor > 0) { flag = true; } else if (dividend > … Continue reading

Posted in Java, LeetCode Solutions, Uncategorized | Tagged | Leave a comment

Using Predicates in Java 8

https://howtodoinjava.com/java-8/how-to-use-predicate-in-java-8/

Posted in Uncategorized | Leave a comment

Using Lambda Expressions

  package src.test.java.examples; /** * @author asharda * */ interface MyNumbers{ boolean test(int a,int b);}public class Lambda { /** * @param args */ public static void main(String[] args) { MyNumbers num; num=(a,b) -> { if(a%b ==0) { return true; } else { return … Continue reading

Posted in Uncategorized | Leave a comment

Space Complexity

Posted in Uncategorized | Leave a comment

Quantum Supremacy

https://www.technologyreview.com/s/610274/google-thinks-its-close-to-quantum-supremacy-heres-what-that-really-means/

Posted in Uncategorized | Leave a comment

HashTable

Posted in Uncategorized | Leave a comment