Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork4
your ticket to the dev world
License
jfullstackdev/java-coding-problems
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
updated July 28, 2024
These are the most common coding problems being asked duringtechnical interviews, as I experienced it myself.
It's the convenience of Codespaces online! Simply create a Codespace, you don't need to install anything, just run using Bash.
Fork the Repository:
- Navigate to the repository you want to fork.
- Click the "Fork" button at the top right corner of the page.
Create a Codespace:
Navigate to the Source Directory:
- Open the terminal in Codespaces.
- Change the directory to
src
:cd src
Run the Java File:
Starting with Java 11, you can run Java files without compiling them first. Use the following command:
java [NameOfTheFile].java
this is the sample interface of the online Codespaces
enjoy!
Binary Search
- Problem: Implement a binary search algorithm to find the position of atarget value within a sorted array.
- Link:View Code
- Discussion: Binary search is an efficient algorithm for finding an itemfrom a sorted list of items. It works by repeatedly dividing in half theportion of the list that could contain the item, until you've narrowed downthe possible locations to just one.
Checking Palindrome
- Problem: Check if a given string is a palindrome.
- Link:View Code
- Discussion: A palindrome is a word, phrase, number, or other sequenceof characters that reads the same forward and backward (ignoring spaces,punctuation, and capitalization). The algorithm typically involvescomparing characters from the beginning and end of the string movingtowards the center.
Inheritance
- Problem: Demonstrate the concept of inheritance in Java.
- Link:View Code
- Discussion: Inheritance is a fundamental concept in object-orientedprogramming where a new class is created from an existing class. The newclass (subclass) inherits attributes and methods from the existing class(superclass), allowing for code reuse and the creation of a hierarchicalrelationship between classes.
Integer Array Sum
- Problem: Calculate the sum of all integers in an array.
- Link:View Code
- Discussion: This problem involves iterating through an array ofintegers and accumulating the sum of its elements. It is a straightforwardproblem that demonstrates basic array manipulation and iteration.
Merge Sort
- Problem: Implement the merge sort algorithm.
- Link:View Code
- Discussion: Merge sort is a divide-and-conquer algorithm that dividesthe input array into two halves, recursively sorts them, and then mergesthe sorted halves. It is known for its efficiency and stable sortingproperties.
Prime Number Checker
- Problem: Check if a given number is a prime number.
- Link:View Code
- Discussion: A prime number is a natural number greater than 1 that hasno positive divisors other than 1 and itself. The algorithm typicallyinvolves checking divisibility from 2 up to the square root of the number.
Fibonacci Series
- Problem: Print the Fibonacci series up to a given number.
- Link:View Code
- Discussion: The Fibonacci series is a sequence where each number is thesum of the two preceding ones, usually starting with 0 and 1. This problemcan be solved using iterative or recursive approaches.
Remove A Character
- Problem: Remove all occurrences of a given character from a string.
- Link:View Code
- Discussion: This problem involves iterating through the string andbuilding a new string that excludes the specified character. Itdemonstrates string manipulation techniques.
Remove Whitespaces
- Problem: Remove all whitespaces from a string.
- Link:View Code
- Discussion: This problem involves iterating through the string andbuilding a new string that excludes all whitespace characters. It is acommon string manipulation task.
Reverse A Linked List
- Problem: Reverse a singly linked list.
- Link:View Code
- Discussion: Reversing a linked list involves changing the direction ofthe pointers in the list. This problem is a classic example of pointermanipulation in data structures.
Reverse A String
- Problem: Reverse a given string.
- Link:View Code
- Discussion: Reversing a string involves swapping characters from thebeginning and end of the string moving towards the center. It is a basicstring manipulation problem.
Shuffle Array
- Problem: Shuffle the elements of an array randomly.
- Link:View Code
- Discussion: Shuffling an array involves randomly permuting itselements. This can be achieved using algorithms like the Fisher-Yatesshuffle.
Sort Array
- Problem: Sort an array of integers.
- Link:View Code
- Discussion: Sorting an array involves arranging its elements in aspecific order (ascending or descending). Various algorithms can be used,such as quicksort, mergesort, or bubble sort.
Check Vowels
- Problem: Check if a string contains any vowels.
- Link:View Code
- Discussion: This problem involves iterating through the string andchecking for the presence of vowel characters (a, e, i, o, u). Itdemonstrates basic string traversal and condition checking.
This is based on :
https://www.journaldev.com/370/java-programming-interview-questions
I don't know about the specific license the author usedbut I'm still including his link for his copyright.
When you copy my work, include the author's linkand my MIT license for my modifications.
for more Java discussion and other details,check the Main Page ->Java
About
your ticket to the dev world
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.