Giter Site home page Giter Site logo

easy-algorithms-mgn3's Introduction

Review Assignment Due Date

basic-algorithms

Sum of Numbers up to a Given Number

Problem Description:

Given a positive integer n, write a Java program to calculate the sum of all positive integers from 1 to n, inclusive.

Function Signature:

public int calculateSum(int n)

Input:

An integer n where 1 <= n <= 10^4.

Output:

An integer representing the sum of all positive integers from 1 to n.

Factorial of a Number

Problem Description:

Write a Java program that computes the factorial of a positive integer entered by the user. Display the result.

Function Signature:

public int calculateFactorial(int n)

Input:

An integer n where n >= 0.

Output:

An integer representing the factorial of n. Prime Number Check

Problem Description:

Develop a Java program that checks whether a given positive integer is a prime number or not. Display an appropriate message.

Function Signature:

public boolean isPrime(int n)

Input:

An integer n where n >= 2.

Output:

A boolean value indicating whether n is prime or not (true for prime, false for non-prime).

Generating Fibonacci Sequence

Problem Description:

Write a Java program to generate the first n terms of the Fibonacci sequence and display them.

Function Signature:

public int[] generateFibonacci(int n)

Input:

An integer n where n >= 1.

Output:

An array of integers representing the first n terms of the Fibonacci sequence.

Drawing Shapes with Stars

Problem Description:

Create a Java program that draws a pattern of asterisk (*) characters based on user input for the number of rows and columns.

Function Signature:

public void drawPattern(int rows, int columns)

Input:

Two integers, rows and columns, where rows and columns are both greater than or equal to 1.

Output:

Display a pattern of asterisk (*) characters with the specified number of rows and columns.

Find the Largest and Smallest Number

Problem Description:

Write a Java program that finds the largest and smallest numbers from a list of integers entered by the user. Display both results.

Function Signature:

public void findMinMax(int[] numbers)

Input:

An array of integers, numbers, where the length of the array is at least 1.

Output:

Display the largest and smallest numbers from the given list.

FizzBuzz

Problem Description:

Write a Java program that prints the numbers from 1 to n. But for multiples of 3, print "Fizz" instead of the number, and for the multiples of 5, print "Buzz". For numbers which are multiples of both 3 and 5, print "FizzBuzz".

Function Signature:

public void fizzBuzz(int n)

Input

An integer n where n >= 1.

Output:

Print the numbers from 1 to n based on the FizzBuzz rules.

1. Loops problems

2. Arrays problem:

3. Hashing problems

4. Two pointer technique

5. Sliding window

6. Stack problems

7. Binary search

8. Linked List

easy-algorithms-mgn3's People

Contributors

github-classroom[bot] avatar mgn3 avatar

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.