Skip to content

Instantly share code, notes, and snippets.

View codeperfectplus's full-sized avatar
🟢
Online

Deepak Raj codeperfectplus

🟢
Online
View GitHub Profile
'''
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'$')
import math
class Complex(object):
def __init__(self, real, imaginary):
self.real = real
self.imaginary = imaginary
def __add__(self, no):
return Complex(self.real + no.real, self.imaginary + no.imaginary)
def plusMinus(arr):
countPositive = 0
countNegative = 0
n = len(arr)
for i in range(n):
if arr[i] > 0:
countPositive += 1
elif arr[i] < 0:
countNegative += 1
countZero = n - countPositive-countNegative
void plusMinus(vector<int> arr) {
float countPositive = 0;
float countNegative = 0;
float n = arr.size();
for(int i;i<n;i++) {
if (arr[i] > 0)
countPositive++;
else if (arr[i] < 0)
def plusMinus(arr):
countPositive = 0
countNegative = 0
n = len(arr)
for i in range(n):
if arr[i] > 0:
countPositive += 1
elif arr[i] < 0:
countNegative += 1
countZero = n - countPositive-countNegative
def is_vowel(letter):
return letter in ['a', 'e', 'i', 'o', 'u', 'y']
def score_words(words):
score = 0
for word in words:
num_vowels = 0
for letter in word:
if is_vowel(letter):
num_vowels += 1