diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..9e50aa4 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: jdevstatic diff --git a/README.md b/README.md index 78d4b8c..9fca01d 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,154 @@ # Java Coding Problems -Hello. +*`updated July 28, 2024`* -These are the most coding problems during +[](https://hits.seeyoufarm.com) + +These are the most common coding problems being asked during technical interviews, as I experienced it myself. ## Running The Code - -It's the convenience of the Codespaces online! -Simply create a Codespace, you don't need to install -anything, just simply run using Bash. - -Also starting Java 11, you can now run it even without compiling ! - -``` -cd src -``` - -then - -``` -java [NameOfTheFile].java -``` - -this is the interface of the online Codespaces - - - -enjoy ! +It's the convenience of Codespaces online! Simply create a Codespace, you don't need to install anything, just run using Bash. + +### Steps to Run the Code +1. **Fork the Repository**: + - Navigate to the repository you want to fork. + - Click the "Fork" button at the top right corner of the page. + +2. **Create a Codespace**: + - Go to your forked repository. + - Click the "Code" button. + - Select "Open with Codespaces" from the dropdown menu. + - If you have Codespaces enabled, you will see an interface like this: +  + +3. **Navigate to the Source Directory**: + - Open the terminal in Codespaces. + - Change the directory to `src`: + ```bash + cd src + ``` + +4. **Run the Java File**: + - Starting with Java 11, you can run Java files without compiling them first. Use the following command: + + ```bash + java [NameOfTheFile].java + ``` + +this is the sample interface of the online Codespaces + + + +enjoy! + +## Source Code +1. **Binary Search** + - **Problem:** Implement a binary search algorithm to find the position of a + target value within a sorted array. + - **Link:** [View Code](https://github.com/jdevstatic/java-coding-problems/blob/main/src/BinarySearch.java) + - **Discussion:** Binary search is an efficient algorithm for finding an item + from a sorted list of items. It works by repeatedly dividing in half the + portion of the list that could contain the item, until you've narrowed down + the possible locations to just one. + +2. **Checking Palindrome** + - **Problem:** Check if a given string is a palindrome. + - **Link:** [View Code](https://github.com/jdevstatic/java-coding-problems/blob/main/src/CheckPalindromeString.java) + - **Discussion:** A palindrome is a word, phrase, number, or other sequence + of characters that reads the same forward and backward (ignoring spaces, + punctuation, and capitalization). The algorithm typically involves + comparing characters from the beginning and end of the string moving + towards the center. + +3. **Inheritance** + - **Problem:** Demonstrate the concept of inheritance in Java. + - **Link:** [View Code](https://github.com/jdevstatic/java-coding-problems/tree/main/src/inheritance) + - **Discussion:** Inheritance is a fundamental concept in object-oriented + programming where a new class is created from an existing class. The new + class (subclass) inherits attributes and methods from the existing class + (superclass), allowing for code reuse and the creation of a hierarchical + relationship between classes. + +4. **Integer Array Sum** + - **Problem:** Calculate the sum of all integers in an array. + - **Link:** [View Code](https://github.com/jdevstatic/java-coding-problems/blob/main/src/IntegerArraySum.java) + - **Discussion:** This problem involves iterating through an array of + integers and accumulating the sum of its elements. It is a straightforward + problem that demonstrates basic array manipulation and iteration. + +5. **Merge Sort** + - **Problem:** Implement the merge sort algorithm. + - **Link:** [View Code](https://github.com/jdevstatic/java-coding-problems/blob/main/src/MergeSort.java) + - **Discussion:** Merge sort is a divide-and-conquer algorithm that divides + the input array into two halves, recursively sorts them, and then merges + the sorted halves. It is known for its efficiency and stable sorting + properties. + +6. **Prime Number Checker** + - **Problem:** Check if a given number is a prime number. + - **Link:** [View Code](https://github.com/jdevstatic/java-coding-problems/blob/main/src/PrimeNumberCheck.java) + - **Discussion:** A prime number is a natural number greater than 1 that has + no positive divisors other than 1 and itself. The algorithm typically + involves checking divisibility from 2 up to the square root of the number. + +7. **Fibonacci Series** + - **Problem:** Print the Fibonacci series up to a given number. + - **Link:** [View Code](https://github.com/jdevstatic/java-coding-problems/blob/main/src/PrintFibonacciSeries.java) + - **Discussion:** The Fibonacci series is a sequence where each number is the + sum of the two preceding ones, usually starting with 0 and 1. This problem + can be solved using iterative or recursive approaches. + +8. **Remove A Character** + - **Problem:** Remove all occurrences of a given character from a string. + - **Link:** [View Code](https://github.com/jdevstatic/java-coding-problems/blob/main/src/RemoveAChar.java) + - **Discussion:** This problem involves iterating through the string and + building a new string that excludes the specified character. It + demonstrates string manipulation techniques. + +9. **Remove Whitespaces** + - **Problem:** Remove all whitespaces from a string. + - **Link:** [View Code](https://github.com/jdevstatic/java-coding-problems/blob/main/src/RemoveWhiteSpaces.java) + - **Discussion:** This problem involves iterating through the string and + building a new string that excludes all whitespace characters. It is a + common string manipulation task. + +10. **Reverse A Linked List** + - **Problem:** Reverse a singly linked list. + - **Link:** [View Code](https://github.com/jdevstatic/java-coding-problems/blob/main/src/ReverseALinkedList.java) + - **Discussion:** Reversing a linked list involves changing the direction of + the pointers in the list. This problem is a classic example of pointer + manipulation in data structures. + +11. **Reverse A String** + - **Problem:** Reverse a given string. + - **Link:** [View Code](https://github.com/jdevstatic/java-coding-problems/blob/main/src/ReverseString.java) + - **Discussion:** Reversing a string involves swapping characters from the + beginning and end of the string moving towards the center. It is a basic + string manipulation problem. + +12. **Shuffle Array** + - **Problem:** Shuffle the elements of an array randomly. + - **Link:** [View Code](https://github.com/jdevstatic/java-coding-problems/blob/main/src/ShuffleArray.java) + - **Discussion:** Shuffling an array involves randomly permuting its + elements. This can be achieved using algorithms like the Fisher-Yates + shuffle. + +13. **Sort Array** + - **Problem:** Sort an array of integers. + - **Link:** [View Code](https://github.com/jdevstatic/java-coding-problems/blob/main/src/SortArray.java) + - **Discussion:** Sorting an array involves arranging its elements in a + specific order (ascending or descending). Various algorithms can be used, + such as quicksort, mergesort, or bubble sort. + +14. **Check Vowels** + - **Problem:** Check if a string contains any vowels. + - **Link:** [View Code](https://github.com/jdevstatic/java-coding-problems/blob/main/src/StringContainsVowels.java) + - **Discussion:** This problem involves iterating through the string and + checking for the presence of vowel characters (a, e, i, o, u). It + demonstrates basic string traversal and condition checking. ## License - This is based on : https://www.journaldev.com/370/java-programming-interview-questions @@ -41,33 +159,12 @@ but I'm still including his link for his copyright. When you copy my work, include the author's link and my MIT license for my modifications. -## Sources -[Binary Search](https://github.com/jdevstatic/java-coding-problems/blob/main/src/BinarySearch.java) - -[Checking Palindrome](https://github.com/jdevstatic/java-coding-problems/blob/main/src/CheckPalindromeString.java) - -[Inheritance](https://github.com/jdevstatic/java-coding-problems/tree/main/src/inheritance) - -[Integer Array Sum](https://github.com/jdevstatic/java-coding-problems/blob/main/src/IntegerArraySum.java) - -[Merge Sort](https://github.com/jdevstatic/java-coding-problems/blob/main/src/MergeSort.java) - -[Prime Number Checker](https://github.com/jdevstatic/java-coding-problems/blob/main/src/PrimeNumberCheck.java) - -[Fibonacci Series](https://github.com/jdevstatic/java-coding-problems/blob/main/src/PrintFibonacciSeries.java) - -[Remove A Character](https://github.com/jdevstatic/java-coding-problems/blob/main/src/RemoveAChar.java) - -[Remove Whitespaces](https://github.com/jdevstatic/java-coding-problems/blob/main/src/RemoveWhiteSpaces.java) - -[Reverse A Linked List](https://github.com/jdevstatic/java-coding-problems/blob/main/src/ReverseALinkedList.java) - -[Reverse A String](https://github.com/jdevstatic/java-coding-problems/blob/main/src/ReverseString.java) - -[Shuffle Array](https://github.com/jdevstatic/java-coding-problems/blob/main/src/ShuffleArray.java) - -[Sort Array](https://github.com/jdevstatic/java-coding-problems/blob/main/src/SortArray.java) - -[Check Vowels](https://github.com/jdevstatic/java-coding-problems/blob/main/src/StringContainsVowels.java) - +## More Java Projects +for more Java discussion and other details, +check the Main Page -> [Java](https://github.com/jdevfullstack/java) +## More Of My Content +- [jdevfullstack Profile](https://github.com/jdevfullstack) +- [jdevfullstack Repos](https://github.com/jdevfullstack?tab=repositories) +- [jdevfullstack Projects](https://github.com/jdevfullstack-projects) +- [jdevfullstack Tutorials](https://github.com/jdevfullstack-tutorials) diff --git a/lombok-221.6008.13.zip b/lombok-221.6008.13.zip deleted file mode 100644 index 1fb6943..0000000 Binary files a/lombok-221.6008.13.zip and /dev/null differ diff --git a/src/BinarySearch.java b/src/BinarySearch.java index 9b47895..f3fe295 100644 --- a/src/BinarySearch.java +++ b/src/BinarySearch.java @@ -22,7 +22,7 @@ public static int binarySearch(int arr[], int low, int high, int key) { public static void main(String[] args) { int intArray[] = {7, 8, 9}; - int key = 5; + int key = 8; if (binarySearch(intArray, 0, 5, key) != -1) { diff --git a/src/inheritance/README.md b/src/inheritance/README.md index 735a892..2c3ffb0 100644 --- a/src/inheritance/README.md +++ b/src/inheritance/README.md @@ -12,7 +12,7 @@ then, we need to compile it first since we will be using another class ``` -java Animal.java Cat.java +javac Animal.java Cat.java ``` then
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: