Skip to content

Instantly share code, notes, and snippets.

View HarshKumarChoudary's full-sized avatar
🎯
Focusing

Harsh kumar choudhary HarshKumarChoudary

🎯
Focusing
  • Chhattisgarh, India
  • 10:24 (UTC +05:30)
View GitHub Profile
@HarshKumarChoudary
HarshKumarChoudary / Play pause button
Last active May 7, 2021 10:54
Css code for play/pause button
This is the HTML Code for making the play/pause buttons design:
<html>
<body>
<style>
.main{
width:350px;
height:210px;
transform:rotate(-30deg);
}
void preZtBc(char *x, int m, int ztBc[ASIZE][ASIZE]) {
int i, j;
for (i = 0; i < ASIZE; ++i)
for (j = 0; j < ASIZE; ++j)
ztBc[i][j] = m;
for (i = 0; i < ASIZE; ++i)
ztBc[i][x[0]] = m - 1;
for (i = 1; i < m - 1; ++i)
ztBc[x[i - 1]][x[i]] = m - 1 - i;
/* suppose the problem says tha we are given an array with only one unique element and rest all elements have their duplicates and we have to find the
unique element in O(n) time and O(1) space complexity then we can use the idea of XOR as shown below:
*/
#include<iostream>
using namespace std;
int main(){
int ans=0;
for(int i=0;i<n;++i)
ans ^= arr[i];
// this will find the unique element in the array in O(1) space complexity
class LRUCache
{
public:
list<int> dq;
int size;
unordered_map<int,pair<list<int>::iterator,int>>m;
public:
//Constructor for initializing the cache capacity with the given value.
LRUCache(int cap)
class LockingTree {
private:
vector<int>parent;
map<int,vector<int>>children;
map<int,int>lockby;
public:
LockingTree(vector<int>& p):parent(p) {
for(int i = 0;i<p.size();++i){
children[p[i]].push_back(i);
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
// Declaration of all functions
//Function 1
ll cnt =0;
ll dfs(ll i,ll pre,vector<ll>&a,vector<vector<ll>>&edges,ll val){
ll cur = a[i];
for(auto x:edges[i]){
if(x==pre)
continue;
cur^=dfs(x,i,a,edges,val);
}
if(cur==val)
++cnt,cur = 0;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <time.h>
// importing files and time lib is used to measure time interval
int main(){
char *ip = "127.0.0.1";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
// importing libraries
int main(){
//intializations
char *ip = "127.0.0.1";
@HarshKumarChoudary
HarshKumarChoudary / Count Number of Free Cell
Created February 6, 2022 14:13
Given a matrix N*N, and an integer K. The matrix initially contains 0, for each i in [1,k] you are given two integers in vectors of size 2 each. These are row and columns respectively. in each time you can update that cells with that row and col to 1. And for each k you have to find the number of cells having 0; IN O (1).
map<long long int,long long int>mr,mc;
long long int cntc = 0;
long long int cntr = 0;
long long int i = 0;
long long int val = (long long int)(n*n);
vector<long long int>ans;
while(k--){
long long r = arr[i][0];
long long c = arr[i][1];