Skip to content

Instantly share code, notes, and snippets.

View prkagrawal's full-sized avatar

Prince Agrawal prkagrawal

View GitHub Profile
@prkagrawal
prkagrawal / Standard 14 Fonts.md
Created January 5, 2023 15:32 — forked from elmariofredo/Standard 14 Fonts.md
Fourteen typefaces—known as the standard 14 fonts—have a special significance in PDF documents
  • Courier
  • Courier-Bold
  • Courier-Oblique
  • Courier-BoldOblique
  • Helvetica
  • Helvetica-Bold
  • Helvetica-Oblique
  • Helvetica-BoldOblique
  • Times-Roman
  • Times-Bold
@prkagrawal
prkagrawal / github.graphql
Created November 8, 2022 10:18
Graphql schema for github.com
"""Autogenerated input type of AcceptTopicSuggestion"""
input AcceptTopicSuggestionInput {
"""The Node ID of the repository."""
repositoryId: ID!
"""The name of the suggested topic."""
name: String!
"""A unique identifier for the client performing the mutation."""
clientMutationId: String
t = int(input())
while(t>0):
t = t - 1
n = int(input())
if(n==1) :
print(1)
continue
if(n%2==0):
print(int(n/2))
continue
@prkagrawal
prkagrawal / AcodeAlphacode.py
Last active June 21, 2020 14:24
#dailyCoding
# This is a "dynamic programming" (aka dp) question and the solution is "recursive"
# Using loop to make the code run until provided non-acceptable input
while True:
n = str(input())
# check if given no is zero
if n == "0":
break
dp = []
# Make an array with a length len(n)+1 with each element as zero
# We will use this array
@prkagrawal
prkagrawal / soldierAndBananas.py
Last active June 20, 2020 15:24
#dailyCoding #python
k,n,w = str(input()).split()
k = int(k)
n = int(n)
w = int(w)
mn = 0
for i in range(w):
mn = mn + (i+1)*k
if n<mn:
print(mn-n)
else:
n = int(input())
# Part 1
for i in range(n):
s = []
for j in range(n):
if i+j-n >= 0:
s.append(str(i+j-n))
else:
s.append(" ")
t = s[::-1]
def stringPatternSearch(text,pattern):
n = len(text)
m = len(pattern)
count = 0
for i in range(n - m + 1):
for j in range(m):
if pattern[j] != text[i+j]:
break
if j == m-1 :
count = count + 1
import random
t = str(random.randint(1000,9999))
def check():
k = str(input("Enter a four digit number : "))
if k == t:
print("Correct : Game Over")
return
elif k != t:
n,t = map(int,input().split())
s = str(input())
l = list(s)
z = len(s) - 1
for i in range(t):
for a in range(z):
if l[a]=='B' and l[a+1]=='G':
l[a] = 'G'
l[a+1] = 'B'
@prkagrawal
prkagrawal / factorialTrailingZeroes.py #dailyCoding
Last active June 20, 2020 15:17
Calculating no of trailing zeroes in factorial of given number
def trailing_zeroes(n):
# 0s are produced when 2 and 5 are multiplied
# so you'll need to count how many 2s and 5s are there
# 2s are always more than 5s so count just 5s
res = 0
k = 5
# find all powers of 5
# 25 has 2 5s, 125 has 3 5s, etc
while k <= n: