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 reverse_words(str): | |
return ' '.join(s[::-1] for s in str.split(' ')) |
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
function find_needle(haystack) { | |
var needleIndex = haystack.IndexOf('needle'); | |
return 'found the needle at position' + needleIndex; | |
} | |
find_needle(['hay', 'junk', 'hay', 'hay', 'moreJunk', 'needle', 'randomJunk']) |
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
function simpleMultiplication(number) { | |
var multi =0; | |
if(number%2==0){ | |
multi = number*8; | |
}else{ | |
multi = number*9; | |
} | |
return multi; | |
console.log(multi) | |
} |
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 isLeapYear(year): | |
if year % 100 == 0: | |
if year % 400 == 0 and year % 4 == 0: | |
return True | |
return False | |
elif year % 4 == 0: | |
return True | |
return False |
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
function isLeapYear(year) { | |
return ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0); | |
} |
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
bool IsLeapYear(int year) | |
{ | |
return (!(year % 400) || (!(year % 4) && year % 100)); | |
} |
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
""" | |
Munene is extremely disappointed to find out that no one in the office knows his first name. Even his close mates call him only by his last name. Frustrated, he decides to make his fellow workmates know his first name by forcing them to solve this question. | |
You are given a long string as input in each testcase, containing any ASCII character. Your task is to find out the number of times SUVO and SUVOJIT appears in it. | |
Note: This problem CAN BE SOLVED IN Java, Python or PHP. | |
Input Format | |
The first line contains the number of testcases, T. Next, T lines follow each containing a long string S. | |
Output Format | |
For each long string S, display the no. of times SUVO and SUVOJIT appears in it.""" |