Last active
September 12, 2019 16:39
-
-
Save marco-souza/878d551987cc54b59695133af8522618 to your computer and use it in GitHub Desktop.
CYW
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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) |
This file contains hidden or 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
SELECT euin.uin, e.name FROM employee as e, employee_uin as euin | |
WHERE e.age < 25 AND e.id = euin.id | |
ORDER BY e.name, e.id ASC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment