- One Loop Design: print a star symbol in one loop
- Longest substring without repeating characters (micro1)
- Anything you can do, I can do better
- Valid Identifier Checker
- Diamond Printer
- Reverse a String
- Check if a vowel exists in a String
- Check for palindrome
- Remove whitespaces
- Remove leading & trailing spaces
- Print all unique words, excluding the same words
- Find the duplicate characters in a string
- Sort String Sequences
- Write a program to find out how many times two given characters appear in any text file.
- Remove all occurrences of a character in a String
- Using Java 8 date-time library in CLASSPATH (package private) file, write a program that shows how you can add time to any time with respect to midnight on Jan. 1, 2000.
- Specify date format
- Bits Manipulation formulas
- Check if a number is a power of 2
- Hamming Weight implementation (return 1-bits of a binary representation of a number)
- Binary to Decimal Converter
- Reverse bits
- Print the Fibonacci sequence
- Factorial
- Maths formulas
- Find the least amount of coins needed for an amount
- Circle Intersection
- Swap two numbers using the third variable
- Swap two numbers without using the third variable
- Prime number finder
- Power
- Find the first duplicate in an array
- Write a program to sort a sequence of numbers in ascending order.
- Missing number
- Sum all elements in an array
- Shuffle an array
- Find the second-largest number in an array
- Find the middle element of a linked list
- Implement a stack using two queues
- Stack Machine Interpretation
- Implement a cache using a HashMap
- Solve the producer-consumer problem using multithreading
- Illustrate a deadlock scenario
- Java: Tricky Interview Problems
- Guess the Output
- Guess the Output - Tilde Bits
- Find the mistakes in a code snippet
-
The rest of Digital Ocean's problems
- Implement Merge Sort
- Compare two arrays' elements
- Sort HashMap by value
- Get distinct chars & their count
- Prove that String is immutable programmatically
- Showcase inheritance
- How do you show a diamond problem with multiple inheritance in Java?
- Illustrate try-catch
- Illustrate NPE
- Create a Record
- Textblocks
- Multilabel switch-case
- Write an interface with
default
&static
method - Create a functional interface
- Illustrate lambda functions
- Illustrate overriding & overloading
-
Arrays
-
Dynamic Programming
-
Graphs
- Given a list of edges and tasked to build your own graph from the edges
- Implement BFS
- Implement DFS
- Implement Dijkstra’s algorithm
- Implement Topological sort
- Implement Bellman-Ford algorithm
- Implement Floyd-Warshall algorithm
- Implement Prim’s algorithm
- Implement Kruskal’s algorithm
- Clone graph
- Course Schedule
- Alien Dictionary
- Pacific Atlantic Water Flow
- Number of Islands
- Graph Valid Tree
- Number of Connected Components in an Undirected Graph
- Longest Consecutive Sequence
-
LinkedLists
-
Maths
-
Matrix
-
Strings
-
Tree
- Maximum Depth of Binary Tree
- Same Tree
- Invert or Flip Binary Tree
- Binary Tree Maximum Path Sum
- Binary Tree Level Order Traversal
- Serialize and Deserialize Binary Tree
- Subtree of Another Tree
- Construct Binary Tree from Preorder and Inorder Traversal
- Validate Binary Search Tree
- Kth Smallest Element in a BST
- Lowest Common Ancestor of BST
-
Heaps
-
Multithreading & Concurrency
- Implement a thread-safe singleton class.
- Write a program to demonstrate the use of synchronized blocks to achieve thread safety.
- Implement a producer-consumer problem using wait() and notify() methods.
- Java’s ExecutorService to execute a list of tasks concurrently.
- Implement a thread-safe cache using ConcurrentHashMap.
- Write a program to demonstrate the use of atomic variables for thread-safe operations.
- Implement a deadlock scenario and explain how to avoid it.
- Use Java’s Lock interface to implement a custom lock for thread synchronization.
- Implement a thread-safe queue using BlockingQueue.
- Write a program to demonstrate the use of CompletableFuture for asynchronous programming.