🐍Python/Python_알고리즘

    [알고리즘] 21. Sock Merchant

    John works at a clothing store. He has a large pile of socks that he must pair by color for sale. Given an array of integers representing the color of each sock, determine how many pairs of socks with matching colors there are.For example, there are socks with colors . There is one pair of color and one of color . There are three odd socks left, one of each color. The number of pairs is .Functio..

    [알고리즘] 20. Bon Appétit

    Anna and Brian are sharing a meal at a restuarant and they agree to split the bill equally. Brian wants to order something that Anna is allergic to though, and they agree that Anna won't pay for that item. Brian gets the check and calculates Anna's portion. You must determine if his calculation is correct.For example, assume the bill has the following prices: . Anna declines to eat item which co..

    [알고리즘] 19. Day of the Programmer

    Marie invented a Time Machine and wants to test it by time-traveling to visit Russia on the Day of the Programmer (the day of the year) during a year in the inclusive range from to .From to , Russia's official calendar was the Julian calendar; since they used the Gregorian calendar system. The transition from the Julian to Gregorian calendar system occurred in , when the next day after January w..

    [알고리즘] 18. Migratory Birds

    You have been asked to help study the population of birds migrating across the continent. Each type of bird you are interested in will be identified by an integer value. Each time a particular kind of bird is spotted, its id number will be added to your array of sightings. You would like to be able to find out which type of bird is most common given a list of sightings. Your task is to print the..

    [알고리즘] 17. Divisivle Sum Pairs

    You are given an array of integers, , and a positive integer, . Find and print the number of pairs where and + is divisible by .For example, and . Our three pairs meeting the criteria are and .Function DescriptionComplete the divisibleSumPairs function in the editor below. It should return the integer count of pairs meeting the criteria.divisibleSumPairs has the following parameter(s):n: the int..

    [알고리즘] 16. Birthday Chocolate

    Lily has a chocolate bar that she wants to share it with Ron for his birthday. Each of the squares has an integer on it. She decides to share a contiguous segment of the bar selected such that the length of the segment matches Ron's birth month and the sum of the integers on the squares is equal to his birth day. You must determine how many ways she can divide the chocolate.Consider the chocolat..