🐍Python/Python_알고리즘
[알고리즘] 51. Beautiful Triplets
Given a sequence of integers , a triplet is beautiful if:Given an increasing sequenc of integers and the value of , count the number of beautiful triplets in the sequence.For example, the sequence and . There are three beautiful triplets, by index: . To test the first triplet, and .Function DescriptionComplete the beautifulTriplets function in the editor below. It must return an integer that rep..
[알고리즘] 50. Encryption
An English text needs to be encrypted using the following encryption scheme. First, the spaces are removed from the text. Let be the length of this text. Then, characters are written into a grid, whose rows and columns have the following constraints:For example, the sentence , after removing spaces is characters long. is between and , so it is written in the form of a grid with 7 rows and 8 colu..
[알고리즘] 49. Modified Kaprekar Numbers
A modified Kaprekar number is a positive whole number with a special property. If you square it, then split the number into two integers and sum those integers, you have the same value you started with.Consider a positive whole number with digits. We square to arrive at a number that is either digits long or digits long. Split the string representation of the square into two parts, and . The rig..
[알고리즘] 48. Taum and B'day
Taum is planning to celebrate the birthday of his friend, Diksha. There are two types of gifts that Diksha wants from Taum: one is black and the other is white. To make her happy, Taum has to buy black gifts and white gifts.The cost of each black gift is units.The cost of every white gift is units.The cost of converting each black gift into white gift or vice versa is units.Help Taum by deducing..
[알고리즘] 47. Equalize the Array
Karl has an array of integers. He wants to reduce the array until all remaining elements are equal. Determine the minimum number of elements to delete to reach his goal.For example, if his array is , we see that he can delete the elements and leaving . He could also delete both twos and either the or the , but that would take deletions. The minimum number of deletions is .Function DescriptionCom..
[알고리즘] 46. Jumping on the Clouds
Emma is playing a new mobile game that starts with consecutively numbered clouds. Some of the clouds are thunderheads and others are cumulus. She can jump on any cumulus cloud having a number that is equal to the number of the current cloud plus or . She must avoid the thunderheads. Determine the minimum number of jumps it will take Emma to jump from her starting postion to the last cloud. It is..