Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shanay Shah #741

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions 1492/solution.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class Solution {
public:
int kthFactor(int n, int k) {
int i,j=0;
for(i=1;i<=n;i++){

if(n%i==0)
{
j++;
if(j==k)
return i;
}

}
return -1;
}
};
16 changes: 16 additions & 0 deletions 239-Sliding-Window-Maximum/sliding-window.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Solution {
public:
vector<int> maxSlidingWindow(vector<int>& nums, int k) {
multiset<int>c;
vector<int>ans;
for(int i=0;i<nums.size();i++)
{
if(i>=k)
c.erase(c.find(nums[i-k]));
c.insert(nums[i]);
if(i>=k-1)
ans.push_back(*c.rbegin());
}
return ans;
}
};
24 changes: 24 additions & 0 deletions 384-Shuffle-an Array/Shuffle-an-Arraay.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class Solution {
public:
vector<int>a,t;
Solution(vector<int>& nums) {
a=nums;
t=nums;
}

vector<int> reset() {
return t;
}

vector<int> shuffle() {
prev_permutation(a.begin(),a.end());
return a;
}
};

/**
* Your Solution object will be instantiated and called as such:
* Solution* obj = new Solution(nums);
* vector<int> param_1 = obj->reset();
* vector<int> param_2 = obj->shuffle();
*/
1 change: 1 addition & 0 deletions Data-Structures-and-Algorithms
Submodule Data-Structures-and-Algorithms added at f1c3ff