Git Product home page Git Product logo

kunal-kushwaha / dsa-bootcamp-java Goto Github PK

View Code? Open in Web Editor NEW
15.4K 448.0 10.1K 99.25 MB

This repository consists of the code samples, assignments, and notes for the Java data structures & algorithms + interview preparation bootcamp of WeMakeDevs.

Home Page: https://www.youtube.com/playlist?list=PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ

Java 100.00%
java interview-preparation data-structures algorithms competitive-programming math leetcode-solutions leetcode leetcode-java google-interview faang-interview faang-preparation faang-questions

dsa-bootcamp-java's Introduction

dsa-bootcamp-java's People

Contributors

alokverma749 avatar avanish460 avatar avijit1999 avatar darecoder avatar deeksha-singh030 avatar deepa-chaurasiya01 avatar dev-madhurendra avatar deveshb15 avatar gauravvv2204 avatar gautamjha3101 avatar geeky01adarsh avatar gowthampb avatar helper-uttam avatar iarchitsharma avatar kunal-kushwaha avatar lohityarra avatar mananmehta3 avatar murtuzaalisurti avatar rishabhrathore055 avatar shivamtyagi12345 avatar soham-samanta avatar sparsh-kamat avatar subhadiptech avatar sujalsamai avatar sujansinhthakor avatar surajpratap10 avatar thatbeautifuldream avatar vishwagauravin avatar vrukshali-26 avatar yesdeepakmittal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dsa-bootcamp-java's Issues

JAVA throws a Array Index Out Of Bounds Exception - Infinite Array

lectures/10-binary search/code/src/com/kunal/InfiniteArray.java
Infinite Array
If the target element is larger than the last element of the array then java throws an Array Index Out of Bounds Exception.
Example:
int[ ] arr = {5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 75, 80}
target = 85;

OUTPUT:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 29 out of bounds for length 14
at binarySearchQuestions.InfiniteArray.ans(InfiniteArray.java:22)
at binarySearchQuestions.InfiniteArray.main(InfiniteArray.java:10)

bug in calculator code

i found a small bug in calculator code with a small change in ans output
(first do an arithmetic operation with any operator and then in next step give an invalid operator the getting the output as invalid operation and the ans of before arithmetic operation i mean getting output both the operations again)
changed code:
package com.coffee;

import java.util.Scanner;

public class SimpleCalci {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int ans = 0;
while (true) {
System.out.println("enter an operator");
char op = in.next().trim().charAt(0);
if (op == '+' || op == '-' || op == '' || op == '%' || op == '/') {
System.out.println("enter two numbers");
int num1 = in.nextInt();
int num2 = in.nextInt();
if (op == '+') {
ans = num1 + num2;
}
if (op == '-') {
ans = num1 - num2;
}
if (op == '
') {
ans = num1 * num2;
}
if (op == '%') {
ans = num1%num2;
}
if (op == '/') {
if (num2 != 0) {
ans = num1 / num2;
}

            }
            System.out.println(ans);
        } else if (op == 'x' || op == 'X') {

            break;
        } else {
            System.out.println("invalid operation");
        }

    }

assignment solutions

there need to be an assignment solution folder for it will give clarity of the answers.

Issue In SmallestLetter.java code

The Output Goes Wrong If We Change the condition, even the both conditions used below means to be same

if (target < letters[mid]) {
                end = mid - 1;
} else {
                start = mid + 1;
}

This is case Check we are using in the SmallestLetter.java code

If we Reverse the conditions checks like
Instead of target < letters[mid] if we use target > letters[mid]
Then code will be

if (target > letters[mid]) {
                start = mid + 1;
} else {
                end = mid - 1;
}

Now If we run the code with letters = { 'c', 'f', 'j' }
and target is 'c'
It outputs 'c' but the answer we expect is 'f'

Here is the complete code after changes in condition
Code

Here is the output
Output

Can Any One please try to solve this issue ??

Out of index exception in infiniteArray.java

In InfiniteArray.java, in line number 21, 'end' achieves such value which the array doesn't really have.

Eg - lets say our array has length of 11 and our target is in the second half of the array.

At starting,
start = 0
end = 1

After 1st execution of while loop,
start = 2, end = 5

After 2nd execution of while loop,
start = 6, end = 13

Now at this line,

while (target > arr[end])

arr[end] means arr[13] which is not in the array.
And it raises an 'Index 13 out of bounds for length 11' exception.

Hope I am able to tell the issue in correct manner.

[Request for an app] Requirements for community classroom app.

Community Classroom app

Goal

I went through the issues on DSA repository of community classroom and found some common ones, so planning to build a mobile app solving those issues. Please go through it and comment down what more requirements do you have.

Requirements

User app

  1. Syllabus tracker:
    • syllabus tracker for all courses. As in when more courses will be added, the app should have it all.
    • Set up reminder to study.
    • not sure if authentication is needed in this app, if auth is required then probably we can go ahead with firestore to store user's progress. Otherwise we can use a simple local DB to store this.
  2. All resources of each course at one place
    • video link, notes link etc
  3. notes sharing (needs approval as app might get spammed and loose quality)
  4. Dark mode

We need approval for these two as this is already on discord so not sure if it's needed on app.

  • announcement section (needs approval)

  • opportunities (needs approval)

Admin app

This app will be used internally by of comm. classroom admins to post content on user app. It will have authentication and It will have features to crud new course, syllabus etc etc.

Need more input from your side, so please comment.

Tech Stack

For backend we can use nodejs to make an API with all these requirements. We can have a separate admin panel kind of app/ web app for people who will post stuff on this app, so that can be either be on react or flutter.

For frontend of mobile app, we can use flutter.

Architecture

I have not thought of architecture of this app as requirements may vary. But most probably it will either be BLoC patten or MVVM pattern depending on complexity of app.

Update link

One of my friend was seeing you git & github video. But when he clicks on the link of cheatsheat it does not work Please update it

Adding Feature to help members find resources easily

Feature to help the community find resources from this repository easily

Hi, @kunal-kushwaha thanks for this great initiative ๐Ÿ’ฏ
I have an idea to create a gh-pages branch that will host a simple UI wherein members can find links to these resources easily and in a folder structure format, it will render the Markdown using React and will use GitHub API to fetch changes so no need to build the web app again for further changes.
I wish to contribute to the community through the knowledge that I have gained over 2-3 years of development.

Features ๐Ÿš€

  1. Organized structure to find resources easily โšก
  2. Search and bookmark ๐Ÿ”
  3. Permalink to share files ๐Ÿ”—
  4. Dark Mode ๐Ÿ˜

Supporting claims

  • Here is the bare minimum site I built during my Second Year that suggests the POC : Classroom Server (UI is not that great btw)
  • Current UI style : My portfolio

Tentetive Tech Stack

  • React.js
  • Redux (if required)
  • Material UI

Time and Space complexity priority

Hey, The syllabus is pretty neat but I had one suggestion. Can we shift Time and Space complexity lectures before Array lectures. As in array, we have sorting techniques. It would be good if we are taught Complexities beforehand so that it gets more clearer. What do you think?

Condition missing in Infinite Array problem

In finding the position of an element in an infinite array if the target element is at 0th or 1st position it will return -1.

So we should add a condition something like this

if (target == arr[start]){
    return start;
} else if (target == arr[end]) {
    return end;
} else {
    return -1;
}

or simply

return target == arr[start] ? start: target == arr[end] ? end: -1;

Question is not clear

Question number 26 under Intermediate java program of Conditionals-loops assignment is little unclear to me.

Kunal is allowed to go out with his friends only on the even days of a given month. Write a program to check if he can go out in the month of August.

Does it mean Kunal is allowed to go out only in the months with even number of days?

program reallocation

the first positive number question is currently in array folder but it should be in searching folder . In array , we are not aware of any searching technique such as binary search or more . so please change its folder to avoid mistakes for the students ...

Code of infinite sorted array is not working

The code is only working for till index 4 i.e element 90 if you search for element 100 it will throw you an error
Index 13 out of bounds for length 11

lectures/10-binary search/code/src/com/kunal/InfiniteArray.java <------- location of the file

The code

package com.kunal;
// https://www.geeksforgeeks.org/find-position-element-sorted-array-infinite-numbers/
public class InfiniteArray {
public static void main(String[] args) {
int[] arr = {3, 5, 7, 9, 10, 90,
100, 130, 140, 160, 170};
int target = 10;
System.out.println(ans(arr, target));
}
static int ans(int[] arr, int target) {
// first find the range
// first start with a box of size 2
int start = 0;
int end = 1;

    // condition for the target to lie in the range
    while (target > arr[end]) {
        int temp = end + 1; // this is my new start
        // double the box value
        // end = previous end + sizeofbox*2
        end = end + (end - start + 1) * 2;
        start = temp;
    }
    return binarySearch(arr, target, start, end);

}
static int binarySearch(int[] arr, int target, int start, int end) {
    while(start <= end) {
        // find the middle element

// int mid = (start + end) / 2; // might be possible that (start + end) exceeds the range of int in java
int mid = start + (end - start) / 2;

        if (target < arr[mid]) {
            end = mid - 1;
        } else if (target > arr[mid]) {
            start = mid + 1;
        } else {
            // ans found
            return mid;
        }
    }
    return -1;
}

}

Some files not visible.

Hey Kunal , When I am opening arrays.md and function.md file in the assignments folder, there is no content showing up inside it. If those files are still under work, please let us know, I will close this issue.

assignments Solution

Some people cannot solve all questions and they google if they didn't find it most skip the question if we provide a folder of assignment solutions where people can put their solutions to check if write or not. Add them in it for future reference.

Update "lectures" folder

Rename files from '1' to '01' like that so it appears in correct order inside the 'lectures' folder.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.