본문 바로가기

length8

1207. Vowel Count Return the number (count) of vowels in the given string. We will consider a, e, i, o, u as vowels for this Kata (but not y). The input string will only consist of lower case letters and/or spaces. Solution: int getCount(String inputStr){ List arr = []; for (String s in inputStr.toLowerCase().split('')) { if (["a","e","i","o","u"].contains(s)) { arr.add(s); } } return arr.length; } import "dart:c.. 2022. 12. 7.
1121. Grasshopper - Grade book Grade book Complete the function so that it finds the average of the three scores passed to it and returns the letter value associated with that grade. Numerical Score Letter Grade 90 2022. 11. 22.
SQL: Padding Encryption You are given a table with the following format: ** encryption table schema ** md5 sha1 sha256 Problem is the table looks so unbalanced - the sha256 column contains much longer strings. You need to balance things up. Add '1' to the end of the md5 addresses as many times as you need to to make them the same length as those in the sha256 column. Add '0' to the beginning of the sha1 values to achie.. 2022. 6. 23.
Easy SQL: Bit Length Given a demographics table in the following format: ** demographics table schema ** id name birthday race you need to return the same table where all text fields (name & race) are changed to the bit length of the string. Solution: SELECT id, BIT_LENGTH(name) AS name, birthday, BIT_LENGTH(race) AS race FROM demographics Result: id name birthday race 1 40 1983-01-30 200 2 40 1974-09-15 200 3 40 19.. 2022. 6. 2.
Easy SQL: Moving Values You have access to a table of monsters as follows: ** monsters table schema ** id name legs arms characteristics Your task is to make a new table where each column should contain the length of the string in the column to its right (last column should contain length of string in the first column). Remember some column values are not currently strings. Column order and titles should remain unchang.. 2022. 5. 29.
Count the divisors of a number Description: Count the number of divisors of a positive integer n. Random tests go up to n = 500000. Examples (input --> output) 4 --> 3 (1, 2, 4) 5 --> 2 (1, 5) 12 --> 6 (1, 2, 3, 4, 6, 12) 30 --> 8 (1, 2, 3, 5, 6, 10, 15, 30) Solution: 1. Repeat 'n' to generate numbers one after the other. 2. Check whether the generated numbers are divisible by 'n'. 3. Count the number of divisible numbers. fu.. 2022. 3. 12.