Skip to content

Commit

Permalink
Merge pull request #3409 from fineanmol/master
Browse files Browse the repository at this point in the history
Tic Tac Toe in HTML CSS and JAVASCRIPT
  • Loading branch information
fineanmol authored Oct 6, 2023
2 parents 3655373 + 38ed886 commit 16a570e
Show file tree
Hide file tree
Showing 177 changed files with 7,513 additions and 2,317 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/approve_merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Auto-Merge PRs

on:
pull_request:
types:
- opened
- synchronize

jobs:
auto_merge:
runs-on: ubuntu-latest

steps:
- name: Check PR status
run: |
PR_NUMBER=$(jq -r ".pull_request.number" "$GITHUB_EVENT_PATH")
PR_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}"
PR_STATE=$(curl -s -H "Authorization: token ${{ secrets.AUTOMERGE_TOKEN }}" $PR_URL | jq -r .state)
if [ "$PR_STATE" = "open" ]; then
echo "PR is still open. Merging..."
curl -s -X PUT -H "Authorization: token ${{ secrets.AUTOMERGE_TOKEN }}" $PR_URL/merge
fi
env:
GITHUB_TOKEN: ${{ secrets.AUTOMERGE_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/auto-comment.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Auto Comment
on: [issues, pull_request]
on: [issues]
jobs:
run:
runs-on: ubuntu-latest
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/message.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/tfsec-pr-commenter.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
.git/objects/
.DS_Store
*.idea*
.github
*.github/
/.vs
6 changes: 0 additions & 6 deletions .vscode/settings.json

This file was deleted.

8 changes: 5 additions & 3 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ diverse, inclusive, and healthy community.
## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:
community includes:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
Expand Down Expand Up @@ -50,11 +50,11 @@ decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
This Code of Conduct applies within all community spaces and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
a representative at an online or offline event.

## Enforcement

Expand Down Expand Up @@ -126,3 +126,5 @@ enforcement ladder](https://github.com/mozilla/diversity).
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.


Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include<bits/stdc++.h>
using namespace std;

int main()
{
vector<int> vals={2,6,3,11,7,4,9,7,10,6};
int target = 20;

sort(vals.begin(),vals.end());
for(int i=0;i<vals.size();i++)
{
int x = vals[i];
int l = i+1;
int r = vals.size()-1;
while(l<r)
{
if(x+vals[l]+vals[r]==target)
{
cout<<"Triplet Found: "<<x<<" "<<vals[l]<<" "<<vals[r]<<endl;
return 0;
}
if(x+vals[l]+vals[r]>target)
{
r--;
}
else
{
l++;
}
}
}

cout<<"No triplet"<<endl;
return 0;
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include<bits/stdc++.h>
using namespace std;

int main()
{
vector<int> nums = {1,1,1,2,3,4,4,4,4,5};
int i = 0, j = 1;
while(j<nums.size())
{
if(nums[i]==nums[j])
j++;
else
{
i++;
nums[i] = nums[j];
}
}
for(int k = 0;k<=i;k++)
cout<<nums[k]<<" ";
cout<<endl;
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include<bits/stdc++.h>
using namespace std;

int main()
{
vector<int> rain = {0,1,0,2,1,0,1,3,2,1,2,1};
int l = 0;
int r = rain.size() -1;
int leftmax = 0;
int rightmax = 0;
int res = 0;
while(l<=r)
{
if(rain[l]<=rain[r])
{
if(rain[l]>=leftmax)
{
leftmax = rain[l];
}
else
{
res+= leftmax - rain[l];
}
l++;
}
else
{
if(rain[r]>=rightmax)
{
rightmax = rain[r];
}
else
{
res+=rightmax - rain[r];
}
r--;
}
}
cout<<res<<endl;
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <iostream>
#include <vector>
using namespace std;
int findTotalWays(vector<int> arr, int i, int s, int target)
{
if (s == target && i == arr.size())
return 1;
if (i >= arr.size())
return 0;
return findTotalWays(arr, i + 1, s + arr[i], target)
+ findTotalWays(arr, i + 1, s - arr[i], target);
}


int main()
{
vector<int> arr = { 1, 1, 1, 1, 1 };


int target = 3;

cout << findTotalWays(arr, 0, 0, target) << endl;

return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

#include <bits/stdc++.h>

using namespace std;
void getUnion(int a[], int n, int b[], int m)
{
set<int> s;
for (int i = 0; i < n; i++)
s.insert(a[i]);

for (int i = 0; i < m; i++)
s.insert(b[i]);
cout << "Number of elements after union operation: " << s.size() << endl;
cout << "The union set of both arrays is :" << endl;
for (auto itr = s.begin(); itr != s.end(); itr++)
cout << *itr
<< " ";
}

int main()
{
int a[9] = { 1, 2, 5, 6, 2, 3, 5, 7, 3 };
int b[10] = { 2, 4, 5, 6, 8, 9, 4, 6, 5, 4 };

getUnion(a, 9, b, 10);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include<bits/stdc++.h>
using namespace std;

int main()
{
vector<int> price = {7,1,5,3,6,4};
int mn =INT_MAX;
int profit = 0;
for(int i=0;i<price.size();i++)
{
mn = min(mn, price[i]);
profit = max(profit, price[i]-mn);
}
cout<<profit<<endl;

return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#include<bits/stdc++.h>
using namespace std;

int merge(vector<int>& nums, vector<int>& temp, int low, int mid, int high)
{
int i,j,k;
int count = 0;
i = low;
j = mid;
k = low;
while(i<=mid-1 and j<=high)
{
if(nums[i]<=nums[j])
{
temp[k++] = nums[i++];
}
else
{
temp[k++] = nums[j++];
count+= mid-i;
}

}
while(i<mid)
{
temp[k++]=nums[i++];
}
while(j<=high)
{
temp[k++] = nums[j++];
}
for(int i=low;i<=high;i++)
nums[i]=temp[i];
return count;
}

int mergesort(vector<int>& nums, vector<int>& temp, int low, int high)
{
int mid, count=0;

if(high>low)
{
mid = (low+high)/2;
count+=mergesort(nums, temp, low, mid);
count+=mergesort(nums, temp, mid+1, high);
count+=merge(nums, temp, low, mid+1, high);
}
return count;
}
int main()
{
vector<int> nums = {5,2,3,4,1};
vector<int> temp(nums.size());
int ans = mergesort(nums, temp, 0, nums.size()-1);
cout<<ans<<endl;
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include<bits/stdc++.h>
using namespace std;

int main()
{
int m = 5;
int n = 4;
int N = m+n-2;
int r = m-1;
int res = 1;
for(int i=0;i<r;i++)
{
res*=(N-r+i+1);
res/=(i+1);

}
cout<<res<<endl;
return 0;
}
Loading

0 comments on commit 16a570e

Please sign in to comment.