len31 0206. Find the nth Digit of a Number Complete the function that takes two numbers as input, num and nth and return the nth digit of num (counting from right to left). Note If num is negative, ignore its sign and treat it as a positive value If nth is not positive, return -1 Keep in mind that 42 = 00042. This means that findDigit(42, 5) would return 0 Examples(num, nth --> output) 5673, 4 --> 5 129, 2 --> 2 -2825, 3 --> 8 -456, 4 --.. 2023. 2. 7. 0121. esreveR Write a function reverse which reverses a list (or in clojure's case, any list-like data structure) (the dedicated builtin(s) functionalities are deactivated) Solution: def reverse(lst): result = list() for _ in range(len(lst)): result.append(lst.pop()) return result 2023. 1. 21. 1229. Parts of a list Write a function partlist that gives all the ways to divide a list (an array) of at least two elements into two non-empty parts. Each two non empty parts will be in a pair (or an array for languages without tuples or a structin C - C: see Examples test Cases - ) Each part will be in a string Elements of a pair must be in the same order as in the original array. Examples of returns in different l.. 2022. 12. 30. 1224. Regex count lowercase letters Your task is simply to count the total number of lowercase letters in a string. Examples lowercaseCount("abc"); ===> 3 lowercaseCount("abcABC123"); ===> 3 lowercaseCount("abcABC123!@€£#$%^&*()_-+=}{[]|\':;?/>. 2022. 12. 25. 1217. Regexp Basics - is it a digit? Implement String#digit? (in Java StringUtils.isDigit(String)), which should return true if given object is a digit (0-9), false otherwise. Solution: def is_digit(n): return len(n) == 1 and n.isdigit() 2022. 12. 17. 1211. Maximum Product Task Given an array of integers , Find the maximum product obtained from multiplying 2 adjacent numbers in the array. Notes Array/list size is at least 2. Array/list numbers could be a mixture of positives, negatives also zeroes . Input >> Output Examples adjacentElementsProduct([1, 2, 3]); ==> return 6 Explanation: The maximum product obtained from multiplying 2 * 3 = 6, and they're adjacent nu.. 2022. 12. 11. 이전 1 2 3 4 ··· 6 다음