Skip to content

Instantly share code, notes, and snippets.

View yashgyy's full-sized avatar
😀

Yash Singhal yashgyy

😀
View GitHub Profile
@yashgyy
yashgyy / Dockerfile
Last active September 20, 2024 02:22 — forked from minhoryang/Dockerfile
docker-ubuntu-build-essential
FROM ubuntu:latest
# Update package list and install necessary packages
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils build-essential sudo git
# Create the 'docker' user, set password, and add the user to the sudo group using 'usermod'
RUN useradd -m docker && echo "docker:docker" | chpasswd && usermod -aG sudo docker
# Switch to the 'docker' user
USER docker
@yashgyy
yashgyy / Merging
Created September 5, 2024 10:10
Sorted LL
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
Example [1,2,4,6,3,7,8] Output: 5
We know Sum of first n natural numbers = n ( n+1) / 2
All the numbers are distinct starting from 1 and are in range 1 to n
int findMissingNumber(int A[], int n) {
int i = 0
for (int j = 0; j<A.length ; j++){
i = i + A[j]
-----------
Walking Trance, marching into
Disparte from ambient and adobe
Hazy lightning, chaotic sound
envelopes a tensy frigid place
Head Held high , perceives the other end
Chalky stools, forsaken and steeped
Tiptoed at the niche, bleakly and moist
Dissimilitude from the swamp
Sometimes, easing anxiety means realizing not every thought or feeling has a deeper meaning.
Some are just visitors passing through. We often assign our ow
n meanings to things and allow them become our trut
library(igraph)
library(ggplot2)
library(dplyr)
read.csv("socidataset.csv") -> a
ggplot(aes(Sign),data=a)+geom_bar(fill=c("Red","Green"))+labs(title="Trust and Distrust")
sort(table(a$X..FromNodeId),decreasing=T)[1:10] -> Top
barplot(Top,space = 0.5,main = "Nodes Having highest out Degree")
sort(table(a$ToNodeId),decreasing=T)[1:10] -> L2
from itertools import combinations
Mutate=[]
for Value1,Value2 in list(combinations(Listing),r=2):
nums=numpy.random.choice([0,1],size=34)
Tupple=[Value1[i] if nums[i]==0 else Value2[i] for i in range(len(nums))]
Mutate.append(Tupple)
Listing2=[]
for j in Mutate:
@yashgyy
yashgyy / Pattern.java
Created November 24, 2018 17:34
Pattern Java Inverted Py
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{