In this article, I will share my own strategy for getting started with DSA. I will share exactly how I started with 2 star at CodeChef and practiced to achieve 4 star in just 3 months. I will share aditional tips on how learning dsa will help you excell as a software engineer and help you land your first job!
3 posts tagged with "dsa"
View All Tags232. Implement Queue using Stacks
Problem Statement
Implement a first in first out (FIFO) queue using only two stacks.
The implemented queue should support all the functions of a normal
queue (push
, peek
, pop
, and empty
).
Implement the MyQueue
class:
void push(int x)
Pushes element x to the back of the queue.
int pop()
Removes the element from the front of the queue and returns it.
int peek()
Returns the element at the front of the queue.
boolean empty()
Returns true
if the queue is empty, false
otherwise.
1143. Longest Common Subsequence, LeetCode
Problem Statement
Given two strings text1
and text2
, return the length of their longest common subsequence. If there is no common subsequence, return 0
.
A subsequence of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.
- For example,
"ace"
is a subsequence of"abcde"
.
A common subsequence of two strings is a subsequence that is common to both strings.