Giter Site home page Giter Site logo

algorithms's People

Stargazers

 avatar

Watchers

 avatar

Forkers

abuharish02

algorithms's Issues

Star Pyramiths

Write the program that gives the following output

*
**
***
..
****.. * (N pieces)
..
***
**
*

Note :

  • Read N (integer) value from console
  • N represents the maximum number of stars in the middle

Example 1:

N : 4
*
**
***
****
***
**
*

Example 2:

N: 3
*
**
***
**
*

Difficulty: 10/3

Sort Zeros

  • Define an integer array with 10 elements.
  • Read 10 integer from console input.
  • Sort zeros to the prefix of array.

For example :
Input : {1, 5, 3, 0, 2, 0 ,10, 0, 9, 8}
Output : {0, 0, 0, 1, 5, 3, 2, 10, 9, 8 }

Difficulty: 10/5

Binary table

Write a program that gives a binary number depends on a N column.

  • Take N value from console
  • Give a binary table to console output.

Example Binary Table (2 columns):
0 0
0 1
1 0
1 1

For example:
N : 3
Output :
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

For example :
N : 5
Output :
0 0 0 0 0
0 0 0 0 1
0 0 0 1 0
0 0 0 1 1
0 0 1 0 0
..
1 1 1 1 1

Difficulty : 10/4

Find maximum repeated character

Read a sentence from console and find which character is maximum repeating character.

Example 1:
Hello world

Frequency: 3, character: L

Example 2:
Ben en çok seni severim.

Frequency: 5, character: e

Replace function

Read a word or a sentence and 2 character from console.
First character is the searched character,
Second character is the replacement of the searched.
Print changed sentence to console.

Example 1 :
Sentence : Change me please.
Searched : e
Replacement : u
Output : Changu mu pluasu.

Example 2 :
Sentence : Yamette kudasai!
Searched : t
Replacement : d
Output: Yamedde kudasai!

Find word in sentence.

Read a sentence and a word from console and search the word in the sentence.

Example 1 :
Sentence : Search me please
Word: me
Output: "me" word is exist on 7-9 indexes of the sentence.

Example 2 :
Sentence : I am starving now!
Word : hungry
Output : "hungry" word is not exist on the sentence!

Check is Prime Number

Read a number from console and check is prime number or not with a recursive function.

Example prime numbers:
2, 3, 5, 7, 11, 13, 17

Example :
N : 23
Output : 23 is a prime number!

N : 32
Output : 32 is not a prime number..

N : 17
Output : 17 is a prime number!

Difficulty : 10/5

Half Number Pyramiths

Write a program that gives a half pyramid of increasing numbers.

  • Read N value from console input
  • Write increasing numbers up to N rows.

Example 1 :

N : 4
Output : 
1 (row 1)
2 3 (row : 2)
4 5 6 (row : 3)
7 8 9 10 (row : 4)

Example 2 :

N : 6
Output : 
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21

Difficulty: 10/5

Reverse Number

Reverse the number read from the console and print it on the screen as output.
Note : Please don't use recursive functions.

For example :
number : 124
output : 421

number : 51224
output : 42215

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.