Skip to content

Instantly share code, notes, and snippets.

View codeperfectplus's full-sized avatar
🟢
Online

Deepak Raj codeperfectplus

🟢
Online
View GitHub Profile
import os
import sys
def timeConversion(s):
#
# Write your code here.
#
time = s.split(':')
if s[-2:] == "PM":
int birthdayCakeCandles(vector<int> ar) {
int max = ar[0];
int count = 0;
int n = ar.size();
for(int i=0;i<n; i++) {
if(ar[i] > max) {
max = ar[i];
}
def birthdayCakeCandles(ar):
count = 0
maxHeight = max(ar)
for i in ar:
if i == maxHeight:
count += 1
return count
#!/bin/python3
def miniMaxSum(arr):
# Write your code here
sum = 0
for element in arr:
sum += element
print(sum - max(arr), sum - min(arr))
if __name__ == '__main__':
void miniMaxSum(vector<int> arr) {
long long min = LLONG_MAX , max = LLONG_MIN , sum ;
for(int i = 0 ;i < arr.size() ; ++i)
{
sum = 0;
for(int j = 0; j < arr.size() ; ++j)
{
if(i != j)
sum += arr[j];
'''
Topic : Algorithms
Subtopic : StairCase
Language : Python
Problem Statement : Write a program that prints a staircase of size 'n'.
Url : https://www.hackerrank.com/challenges/staircase/problem
'''
#!/bin/python3
import math
/*
Topic : Algorithms
Subtopic : StairCase
Language : C++
Problem Statement : Write a program that prints a staircase of size 'n'.
Url : https://www.hackerrank.com/challenges/staircase/problem
*/
#include <bits/stdc++.h>
for i in range(1,int(input())): #More than 2 lines will result in 0 score. Do not leave a blank line also
print( int((i*(pow(10, i) - 1)) / 9 ))
import string
def ginortS(input_string):
small = ""
capital = ""
odd = ""
even = ""
for i in input_string:
import re
# compile the patterns
pattern = re.compile(
r'^'
r'(?!.*(\d)(-?\1){3})'
r'[456]\d{3}'
r'(?:-?\d{4}){3}'
r'$')