This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import pkg_resources | |
import requests | |
from tabulate import tabulate | |
def get_installed_version(package): | |
try: | |
# Fetch the installed version of the package | |
return pkg_resources.get_distribution(package).version | |
except pkg_resources.DistributionNotFound: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
def timeConversion(s): | |
# | |
# Write your code here. | |
# | |
time = s.split(':') | |
if s[-2:] == "PM": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def birthdayCakeCandles(ar): | |
count = 0 | |
maxHeight = max(ar) | |
for i in ar: | |
if i == maxHeight: | |
count += 1 | |
return count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 )) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
def ginortS(input_string): | |
small = "" | |
capital = "" | |
odd = "" | |
even = "" | |
for i in input_string: |
NewerOlder