Skip to content

zafir0-0/Typescript_problem_solving

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeScript Programming Problem Solving

This repository contains solutions to TypeScript programming problems. Each problem is implemented as a separate TypeScript file and can be executed individually using Node.js and TypeScript.


Assignment Questions

1. Difference Between Maximum and Second Maximum

Find the difference between the largest and second largest numbers in an array.

2. Sum of Prime Numbers

Calculate the sum of all prime numbers in an array.

3. Sum of Unique Elements After Removing Duplicates

Remove duplicate values from an array and calculate the sum of the unique elements.

4. Find the Missing Number

Find the missing number in a sequence using the formula:

n × (n + 1) / 2 - sumOfArray

5. Count Occurrence of Each Number

Count how many times each number appears in an array.

6. Return Repetitive Elements

Return only the elements that appear more than once in an array.

7. Print Unique Characters from a String

Print all unique characters from a string and count them.

8. Print All Permutations of a String

Generate and print all possible permutations of a string.

9. Generate a Random Password

Generate a random password containing:

  • At least one uppercase letter
  • At least one lowercase letter
  • At least one number
  • At least one special character

10. Remove All Special Characters

Remove all special characters from a string.

11. Remove All Vowels from a String

Remove all vowels from a string.

12. Check Valid Binary Number

Check whether a given string is a valid binary number.

13. Extract Digits and Calculate Discounted Total

Extract numeric values from a paragraph and calculate the final discounted price.

14. Currency Note Breakdown

Break down a given amount into the minimum number of currency notes.

15. Find 5-Mark and 10-Mark Questions

Determine the number of 5-mark and 10-mark questions required to make the total marks.


Google Docs

Google Docs containing all TypeScript programs (in sequential order):

Link:

Click Here to See all the programs


Prerequisites

Install the following before running the programs:

  • Node.js
  • TypeScript
  • ts-node
  • prompt-sync (for programs that require user input)

Installation

Clone the repository:

git clone https://github.com/zafir0-0/Typescript_problem_solving.git

Go to the project directory:

cd Typescript_problem_solving

Install dependencies:

npm install

If TypeScript is not installed globally:

npm install -g typescript

Install ts-node:

npm install -g ts-node

Install prompt-sync:

npm install prompt-sync

How to Run a Program

Using ts-node

npx ts-node filename.ts

Example:

npx ts-node 02_Sum_Of_Prime_Numbers.ts

Or Compile and Run

Compile:

tsc filename.ts

Run:

node filename.js

Example:

tsc 02_Sum_Of_Prime_Numbers.ts
node 02_Sum_Of_Prime_Numbers.js

Technologies Used

  • TypeScript
  • Node.js
  • ts-node
  • prompt-sync

About

A collection of TypeScript programming exercises and solutions covering arrays, strings, algorithms, recursion, and basic programming concepts.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors