Skip to content

yjain-7/Problem_Setter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Data Structures and Algorithms Repository

This repository contains solutions to various data structure and algorithm problems implemented in Java and C++.

Problem Descriptions

1. Isomorphic String

Problem Statement:

Given two strings s and t, determine if they are isomorphic.

Two strings are isomorphic if the characters in s can be replaced to get t.

All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character but a character may map to itself.

Examples:

  1. Input: s = "egg", t = "add" Output: true

  2. Input: s = "foo", t = "bar" Output: false

  3. Input: s = "paper", t = "title" Output: true

Files:

  • IsomorphicString.java (Java implementation)
  • IsomorphicString.cpp (C++ implementation)
  • TestIsomorphicString.java (Test cases for Java)

2. Two Sum Problem

Problem Statement:

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

You can return the answer in any order.

Examples:

  1. Input: nums = [2, 7, 11, 15], target = 9 Output: [0, 1] (nums[0] + nums[1] = 2 + 7 = 9)

  2. Input: nums = [3, 2, 4], target = 6 Output: [1, 2] (nums[1] + nums[2] = 2 + 4 = 6)

  3. Input: nums = [3, 3], target = 6 Output: [0, 1] (nums[0] + nums[1] = 3 + 3 = 6)

Files:

  • TwoSum.java (Java implementation)
  • TwoSum.cpp (C++ implementation)
  • TestTwoSum.java (Test cases for Java)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors