Created
September 12, 2019 16:14
-
-
Save marco-souza/54ccd1d70d665a642886a6a505d2a337 to your computer and use it in GitHub Desktop.
CYW
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
/* | |
Enter your query here. | |
Please append a semicolon ";" at the end of the query | |
*/ | |
SELECT c.name, MAX(p.id) | |
FROM customer as c, payment as p | |
WHERE p.status LIKE "CO" and p.customer_id = c.id | |
GROUP BY c.name | |
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 applyRoundingRules(original_amount): | |
if original_amount < 25: | |
return 50 | |
# Write your code here | |
int_div = original_amount // 50 | |
rest_div = original_amount % 50 | |
return int_div * 50 if rest_div < 25 else (int_div + 1) * 50 |
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 generateSkylineString(buildingHeightsAsString): | |
result = [] | |
for i in range(9): | |
line = ['#' if (9 - i) <= int(j) else ' ' for j in buildingHeightsAsString] | |
result.append(''.join(line)) | |
return '\n'.join(result) |
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 decompress(linesAsStringArray): | |
result = [] | |
for line in linesAsStringArray: | |
list_char = line[::2] | |
list_num = line[1::2] | |
result.append(''.join([ list_char[i] * int(list_num[i]) for (i, _) in enumerate(list_char)])) | |
return '\n'.join(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment