Statistics

Problem Statement for "NewPhone"

Problem Statement

You just got a phone with a speed-dial feature, and you want to determine which numbers to store in the speed-dial memory. To do this, you look at last month's bill, and decide to use the numbers that appear most frequently on the bill.

Create a class NewPhone that contains the method bestNumbers, which takes three arguments:
numbers: A String[] representing all the numbers you called last month. Each String has the form "NNN-NNN-NNNN", where N is a numerical digit ('0'-'9').
frequencies: A int[] indicating how many times each number was called last month. Element i of this int[] maps to element i of numbers.
spaces: The number of memory spaces available to use.

The method should return a String[] of the numbers to program into the memory spaces available, starting with the most frequently called number, and going in decreasing frequency order. If two or more numbers are called the same number of times, they should be returned in the order they were in the original input. The size of the return value should be equal to spaces, discarding any numbers that do not fit into the result. If two or more numbers have the same frequency, but not all of them will fit in the result, add the ones that were first in the original input (See example 3).

Definition

Class:
NewPhone
Method:
bestNumbers
Parameters:
String[], int[], int
Returns:
String[]
Method signature:
String[] bestNumbers(String[] numbers, int[] frequencies, int spaces)
(be sure your method is public)

Constraints

  • numbers will have between 1 and 50 elements, inclusive.
  • Each element in numbers will have the form "NNN-NNN-NNNN", where each N is a digit ('0'-'9').
  • There will be no repeated elements in numbers.
  • frequencies will have the same number of elements as numbers.
  • Each element of frequencies will be between 1 and 100, inclusive.
  • spaces will be between 1 and length of numbers, inclusive.

Examples

  1. {"123-456-7890", "012-333-4455", "800-825-6699"}

    {3,2,1}

    3

    Returns: { "123-456-7890", "012-333-4455", "800-825-6699" }

    You made 6 calls last month, three of them were 123-456-7890, two of them were 012-333-4455, and the last was 800-825-6699. Given the frequency of the numbers, they are already in the order of most frequent to least frequent, and there are enough spaces to hold all the numbers.

  2. {"123-456-7890", "012-333-4455", "800-825-6699"}

    {3,1,2}

    3

    Returns: { "123-456-7890", "800-825-6699", "012-333-4455" }

    Now, the second and third numbers are out of order.

  3. {"123-456-7890", "012-333-4455", "800-825-6699"}

    {3,1,2}

    2

    Returns: { "123-456-7890", "800-825-6699" }

    Now, there are only two spaces available for speed-dial numbers.

  4. {"123-456-7890", "012-333-4455", "800-825-6699", "333-333-3333"}

    {3,1,3,3}

    2

    Returns: { "123-456-7890", "800-825-6699" }

    Three numbers were called with a frequency of 3. Since the first and third elements come before the fourth, they are programmed first, and there is not enough room for the fourth element in the memory spaces.

  5. {"123-456-7891"}

    {100}

    1

    Returns: { "123-456-7891" }

  6. {"717-137-7103", "910-888-0086", "355-972-4310", "209-377-7313", "347-517-1283", "841-514-7055", "384-548-2401", "582-628-9528", "133-811-3566", "340-447-2363", "544-105-0360", "375-005-3442", "395-693-5376", "340-532-8329", "809-340-9581", "109-406-1339", "149-208-5882", "198-578-7760", "966-351-3893", "388-370-6991", "773-556-1923", "473-899-9364", "790-945-8206", "158-125-2467", "288-034-2510", "636-748-9230"}

    {33, 42, 27, 15, 72, 27, 47, 87, 42, 33, 33, 73, 16, 9, 50, 37, 3, 37, 9, 35, 10, 22, 73, 72, 34, 73}

    9

    Returns: { "582-628-9528", "375-005-3442", "790-945-8206", "636-748-9230", "347-517-1283", "158-125-2467", "809-340-9581", "384-548-2401", "910-888-0086" }

  7. {"523-910-0636", "196-274-1273", "501-791-7100", "683-788-8194", "143-782-1481", "915-183-8171", "764-150-6409", "048-849-5592", "209-140-9285", "719-992-7501", "965-106-9006", "626-884-7350", "214-614-3546", "470-576-1664", "730-162-3070", "468-956-2585", "590-596-1751", "456-858-2265", "596-461-4120", "824-612-3298", "494-140-0396"}

    {59, 34, 16, 88, 92, 16, 92, 92, 4, 53, 87, 10, 88, 87, 4, 72, 79, 88, 1, 92, 53}

    2

    Returns: { "143-782-1481", "764-150-6409" }

  8. {"400-297-7063", "747-366-1444", "024-997-2217", "266-695-0481", "525-910-3024", "345-179-7136", "879-712-4851", "956-944-3700", "337-038-1531", "624-139-0390", "731-973-9452", "803-682-6306", "807-300-5353", "567-277-9416", "952-190-3573", "235-010-1419", "945-234-4346", "374-831-2872", "097-786-1018"}

    {37, 8, 47, 55, 33, 3, 1, 43, 43, 88, 37, 1, 96, 53, 1, 72, 1, 60, 10}

    2

    Returns: { "807-300-5353", "624-139-0390" }

  9. {"406-256-4034", "941-237-2151", "729-437-6543", "942-245-2425", "523-488-1998", "439-237-9395", "547-738-3235", "074-542-0351", "897-048-0320", "156-759-6632", "188-658-1082", "541-271-3515", "345-169-8519", "825-399-5477", "813-385-0903", "246-490-0193", "627-139-7757", "854-594-9583", "404-071-0487", "043-435-9648", "864-469-3342", "779-628-1073", "461-110-6935", "952-808-1484", "100-645-3188", "984-010-2810", "415-139-9042", "639-912-5409", "927-451-6354", "594-998-1978", "226-367-0695", "692-427-1625", "195-662-1911", "492-875-5174", "321-866-9247", "262-471-8256", "108-689-8335", "289-848-9430", "207-994-5857", "948-491-6001", "417-077-7100", "144-782-8043"}

    {82, 48, 47, 23, 12, 23, 23, 94, 22, 24, 22, 47, 78, 60, 43, 79, 72, 94, 70, 43, 72, 11, 24, 90, 77, 86, 31, 90, 24, 24, 22, 48, 11, 16, 86, 40, 39, 94, 27, 48, 48, 94}

    28

    Returns: { "074-542-0351", "854-594-9583", "289-848-9430", "144-782-8043", "952-808-1484", "639-912-5409", "984-010-2810", "321-866-9247", "406-256-4034", "246-490-0193", "345-169-8519", "100-645-3188", "627-139-7757", "864-469-3342", "404-071-0487", "825-399-5477", "941-237-2151", "692-427-1625", "948-491-6001", "417-077-7100", "729-437-6543", "541-271-3515", "813-385-0903", "043-435-9648", "262-471-8256", "108-689-8335", "415-139-9042", "207-994-5857" }

  10. {"856-936-3434", "240-896-1327", "223-697-9029", "826-193-0166", "335-992-3180"}

    {67, 1, 39, 15, 1}

    2

    Returns: { "856-936-3434", "223-697-9029" }

  11. {"970-979-3256", "487-172-2432", "282-251-4682", "799-714-5818", "631-967-5947", "390-043-4858", "358-132-1518", "063-957-9562", "980-750-9588", "211-339-0616", "033-903-9577", "111-820-5086", "854-445-5475", "773-645-2604", "005-241-9952", "423-555-8114", "210-128-9695", "870-474-4233", "486-045-9784", "581-932-6183", "407-875-5998", "130-378-3511", "934-878-2701", "884-297-1268", "192-025-5544"}

    {7, 66, 64, 38, 66, 27, 7, 58, 38, 27, 49, 38, 38, 38, 10, 66, 7, 38, 66, 7, 7, 58, 7, 7, 30}

    1

    Returns: { "487-172-2432" }

  12. {"807-696-1226", "666-616-5317", "864-079-0147", "434-885-6638", "947-314-4953", "875-239-1833", "281-335-9061", "009-779-7715", "577-071-4559", "982-815-8810", "801-483-0003", "823-392-9072"}

    {33, 27, 33, 27, 33, 27, 27, 33, 27, 33, 27, 33}

    8

    Returns: { "807-696-1226", "864-079-0147", "947-314-4953", "009-779-7715", "982-815-8810", "823-392-9072", "666-616-5317", "434-885-6638" }

  13. {"306-122-0659", "249-089-8874", "429-878-4481", "718-002-9585", "162-804-1720", "837-819-4502", "916-582-2537", "194-231-1724", "076-557-2273"}

    {93, 45, 45, 8, 5, 99, 93, 99, 63}

    5

    Returns: { "837-819-4502", "194-231-1724", "306-122-0659", "916-582-2537", "076-557-2273" }

  14. {"744-601-3530", "264-556-3571", "319-051-9865", "170-152-3852", "731-440-9072", "408-953-2711", "331-030-2635", "000-622-4411", "848-486-1509", "984-929-3650", "175-287-7598", "923-918-5876", "111-112-0709", "107-460-4308", "418-967-4839", "707-759-8622", "002-527-8790", "037-218-4931", "700-520-3724", "372-634-2984", "026-744-2624", "800-082-4997", "766-166-6220", "881-499-3400", "999-501-7551", "544-288-5761", "328-466-8253", "168-751-7727", "695-722-8695", "671-281-9766", "533-891-7277", "154-303-6442", "489-247-4515", "073-409-2754", "252-759-5279", "848-403-2377", "963-220-4761", "288-981-8371", "789-382-3470", "131-011-9971", "775-031-3385", "223-743-2040", "681-361-0745", "987-109-7374", "924-712-9465"}

    {65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65}

    45

    Returns: { "744-601-3530", "264-556-3571", "319-051-9865", "170-152-3852", "731-440-9072", "408-953-2711", "331-030-2635", "000-622-4411", "848-486-1509", "984-929-3650", "175-287-7598", "923-918-5876", "111-112-0709", "107-460-4308", "418-967-4839", "707-759-8622", "002-527-8790", "037-218-4931", "700-520-3724", "372-634-2984", "026-744-2624", "800-082-4997", "766-166-6220", "881-499-3400", "999-501-7551", "544-288-5761", "328-466-8253", "168-751-7727", "695-722-8695", "671-281-9766", "533-891-7277", "154-303-6442", "489-247-4515", "073-409-2754", "252-759-5279", "848-403-2377", "963-220-4761", "288-981-8371", "789-382-3470", "131-011-9971", "775-031-3385", "223-743-2040", "681-361-0745", "987-109-7374", "924-712-9465" }

  15. {"855-699-8918", "535-948-7525", "843-753-1157", "946-166-0723", "917-531-3833", "572-492-4309", "210-671-9743", "226-398-6248", "623-049-2553", "594-762-2683", "843-238-0756", "084-577-9786", "982-851-9578", "654-937-9171", "668-131-7212", "933-046-6728", "269-459-0004", "945-228-3951", "883-600-8118", "787-720-8264", "644-111-5825", "343-457-1477", "693-286-1793", "391-505-4483", "067-849-2813", "226-472-3835", "518-058-7451", "253-332-9933", "671-473-8707", "178-374-0004", "372-983-6384", "838-623-1645", "922-375-7550", "110-921-1118", "605-776-2557", "867-558-5134", "893-487-4664", "804-202-7847", "711-308-7671", "776-340-7455", "937-083-9955", "160-502-4917", "355-394-6394", "868-683-9985", "774-119-7753"}

    {66, 85, 85, 85, 69, 92, 66, 69, 85, 69, 69, 92, 66, 66, 85, 32, 66, 32, 66, 92, 32, 85, 69, 85, 92, 32, 32, 69, 69, 92, 92, 66, 66, 69, 92, 32, 32, 92, 66, 66, 69, 85, 92, 85, 32}

    24

    Returns: { "572-492-4309", "084-577-9786", "787-720-8264", "067-849-2813", "178-374-0004", "372-983-6384", "605-776-2557", "804-202-7847", "355-394-6394", "535-948-7525", "843-753-1157", "946-166-0723", "623-049-2553", "668-131-7212", "343-457-1477", "391-505-4483", "160-502-4917", "868-683-9985", "917-531-3833", "226-398-6248", "594-762-2683", "843-238-0756", "693-286-1793", "253-332-9933" }

  16. {"552-590-1311", "676-780-3706", "550-674-8899", "571-955-1390", "509-847-7940", "148-117-2885", "445-469-5607", "290-858-7825", "292-367-2679", "653-667-0875", "923-863-8145", "604-500-9952", "296-987-1403", "317-629-7973", "540-954-0265", "522-366-8371", "675-824-3561", "144-038-1400", "461-263-3639", "609-673-8859", "180-327-1154", "203-408-5040", "946-668-7630", "702-454-3411", "775-471-0327", "820-904-4357", "596-076-9112", "011-468-2969", "104-515-3658", "254-823-1627"}

    {5, 83, 24, 14, 32, 24, 83, 5, 29, 32, 5, 32, 14, 32, 83, 32, 24, 14, 32, 29, 14, 29, 83, 21, 5, 21, 29, 14, 21, 24}

    6

    Returns: { "676-780-3706", "445-469-5607", "540-954-0265", "946-668-7630", "509-847-7940", "653-667-0875" }

  17. {"197-683-8341", "570-411-1537", "588-371-1463", "223-490-5162", "647-246-4314", "456-810-5633", "296-396-8037", "469-139-0700", "790-032-0449", "241-656-0449", "911-696-7890", "872-134-1284", "158-231-8192", "501-801-3066"}

    {16, 75, 45, 17, 75, 73, 16, 97, 16, 75, 74, 74, 35, 97}

    4

    Returns: { "469-139-0700", "501-801-3066", "570-411-1537", "647-246-4314" }

  18. {"062-379-4772", "422-176-9666", "007-462-3760", "699-805-2249", "766-513-1918", "331-477-3377", "454-808-1889", "468-959-9407", "455-004-4306", "117-824-3494", "211-441-4370", "851-009-1208", "464-780-0353", "768-939-4597", "682-459-7341", "053-565-2458", "772-927-5259", "150-126-3955", "630-467-9982", "858-811-6378", "158-379-9263", "613-164-1300", "669-297-0125", "755-220-7805", "210-179-7172", "398-940-9646"}

    {53, 37, 2, 91, 26, 75, 89, 19, 2, 37, 19, 21, 22, 21, 82, 94, 28, 82, 94, 65, 91, 2, 22, 28, 75, 65}

    11

    Returns: { "053-565-2458", "630-467-9982", "699-805-2249", "158-379-9263", "454-808-1889", "682-459-7341", "150-126-3955", "331-477-3377", "210-179-7172", "858-811-6378", "398-940-9646" }

  19. {"643-379-7456", "216-019-1839", "977-620-2701", "610-454-8669", "450-664-8825", "982-688-7437", "296-142-2533", "153-695-8190", "495-075-6458", "291-076-7590", "633-681-9975", "420-687-2828", "135-837-2425", "277-217-5526", "400-903-5299", "848-631-3598", "275-980-5782", "275-512-2230", "261-152-4929", "897-748-8430", "340-402-0113", "015-991-2826", "138-326-0022", "547-795-0622", "383-973-8055", "674-955-9144", "232-130-6693", "569-315-4133", "373-014-1237", "231-451-7081", "772-564-2417", "930-516-5818", "589-610-6874", "406-571-1701", "369-018-5751", "955-073-3217", "264-514-1856", "245-352-7271", "416-249-6340", "051-509-7294", "443-049-3574", "376-635-8003", "738-675-8485", "676-993-2456", "513-950-0053", "681-625-3936", "061-572-4434", "379-315-1279", "465-409-4481"}

    {20, 53, 78, 80, 97, 90, 57, 26, 68, 100, 79, 44, 77, 66, 45, 38, 20, 80, 28, 12, 44, 28, 24, 36, 14, 68, 91, 52, 74, 90, 68, 54, 87, 100, 93, 74, 79, 97, 24, 68, 14, 74, 28, 68, 87, 66, 53, 44, 28}

    44

    Returns: { "291-076-7590", "406-571-1701", "450-664-8825", "245-352-7271", "369-018-5751", "232-130-6693", "982-688-7437", "231-451-7081", "589-610-6874", "513-950-0053", "610-454-8669", "275-512-2230", "633-681-9975", "264-514-1856", "977-620-2701", "135-837-2425", "373-014-1237", "955-073-3217", "376-635-8003", "495-075-6458", "674-955-9144", "772-564-2417", "051-509-7294", "676-993-2456", "277-217-5526", "681-625-3936", "296-142-2533", "930-516-5818", "216-019-1839", "061-572-4434", "569-315-4133", "400-903-5299", "420-687-2828", "340-402-0113", "379-315-1279", "848-631-3598", "547-795-0622", "261-152-4929", "015-991-2826", "738-675-8485", "465-409-4481", "153-695-8190", "138-326-0022", "416-249-6340" }

  20. {"228-293-4056", "244-376-8403", "557-032-5140", "995-887-2144", "676-587-4641", "575-664-3405", "448-005-8433", "423-853-3921", "380-670-8851", "580-043-7908", "993-780-6197", "704-344-8576", "313-343-9902", "281-136-8984", "506-829-0022", "897-967-3704", "273-678-7805", "835-601-1230", "061-776-6988", "320-409-1300", "991-630-2309", "018-243-1750", "230-538-7800", "111-032-1889", "042-101-6799", "344-539-3087", "485-629-9334", "051-989-0716", "053-878-6523", "776-369-2185", "864-181-0736", "769-379-9198", "031-649-2191", "300-457-7546", "471-127-8207", "530-129-9271", "131-865-4088", "872-302-2755"}

    {87, 41, 2, 35, 87, 2, 41, 1, 1, 26, 35, 90, 41, 41, 1, 35, 35, 87, 26, 26, 41, 26, 2, 87, 87, 2, 90, 87, 1, 1, 26, 1, 1, 35, 2, 35, 41, 41}

    28

    Returns: { "704-344-8576", "485-629-9334", "228-293-4056", "676-587-4641", "835-601-1230", "111-032-1889", "042-101-6799", "051-989-0716", "244-376-8403", "448-005-8433", "313-343-9902", "281-136-8984", "991-630-2309", "131-865-4088", "872-302-2755", "995-887-2144", "993-780-6197", "897-967-3704", "273-678-7805", "300-457-7546", "530-129-9271", "580-043-7908", "061-776-6988", "320-409-1300", "018-243-1750", "864-181-0736", "557-032-5140", "575-664-3405" }

  21. {"290-563-3637", "987-363-3319", "542-949-9292", "667-026-7264", "523-368-7054", "943-704-6250", "478-200-8798", "264-225-2709", "777-230-1626", "481-673-9138", "537-223-0728", "345-715-5304", "827-884-9003", "973-250-9619", "824-050-1966", "296-617-7695", "595-487-9783", "143-784-5249", "096-695-3242", "783-977-7311", "968-883-3183", "566-336-0941", "799-782-9385", "521-944-5204", "358-387-2167", "965-593-3820", "976-101-0908", "692-988-1595", "886-585-4389", "017-241-5202", "433-092-4183", "516-373-8079", "727-032-1742", "036-016-5893", "024-159-0643", "922-900-5269", "122-249-8791", "810-053-2598", "048-932-9695", "609-870-6969", "083-341-3284", "559-746-3019", "208-411-0802", "459-672-6388"}

    {12, 53, 34, 21, 86, 13, 13, 73, 86, 55, 53, 93, 86, 41, 12, 73, 36, 73, 36, 93, 73, 36, 73, 93, 19, 63, 63, 19, 86, 93, 63, 19, 41, 41, 73, 21, 13, 53, 36, 12, 36, 86, 21, 19}

    40

    Returns: { "345-715-5304", "783-977-7311", "521-944-5204", "017-241-5202", "523-368-7054", "777-230-1626", "827-884-9003", "886-585-4389", "559-746-3019", "264-225-2709", "296-617-7695", "143-784-5249", "968-883-3183", "799-782-9385", "024-159-0643", "965-593-3820", "976-101-0908", "433-092-4183", "481-673-9138", "987-363-3319", "537-223-0728", "810-053-2598", "973-250-9619", "727-032-1742", "036-016-5893", "595-487-9783", "096-695-3242", "566-336-0941", "048-932-9695", "083-341-3284", "542-949-9292", "667-026-7264", "922-900-5269", "208-411-0802", "358-387-2167", "692-988-1595", "516-373-8079", "459-672-6388", "943-704-6250", "478-200-8798" }

  22. {"162-258-2193", "974-987-6663", "873-409-1609", "997-011-6751", "685-971-0557", "558-386-0502", "706-686-7777", "949-529-4119", "778-314-3751", "337-126-4345", "506-348-6625", "919-370-4524", "047-836-9406", "984-645-9984", "218-740-3727", "175-848-7901"}

    {8, 86, 47, 47, 74, 47, 47, 8, 61, 61, 61, 83, 74, 83, 86, 61}

    12

    Returns: { "974-987-6663", "218-740-3727", "919-370-4524", "984-645-9984", "685-971-0557", "047-836-9406", "778-314-3751", "337-126-4345", "506-348-6625", "175-848-7901", "873-409-1609", "997-011-6751" }

  23. {"394-752-5318", "188-030-0382", "399-896-1084", "994-688-3770", "151-343-4891", "262-544-2001", "015-028-4332", "547-440-7123", "479-722-6778"}

    {13, 62, 66, 81, 68, 81, 13, 13, 66}

    3

    Returns: { "994-688-3770", "262-544-2001", "151-343-4891" }

  24. {"787-176-2228", "897-262-8319", "411-385-2663", "393-638-5893", "445-626-7750", "046-653-1005", "094-483-3144", "282-297-3189", "036-155-3677", "086-140-5118", "386-720-3548", "354-052-5219", "580-109-8368", "802-697-9450", "147-609-3639", "049-250-0922"}

    {11, 4, 24, 4, 95, 24, 77, 20, 11, 90, 44, 95, 44, 75, 11, 20}

    1

    Returns: { "445-626-7750" }

  25. {"813-015-5094", "580-636-8624", "454-971-1196"}

    {71, 63, 71}

    3

    Returns: { "813-015-5094", "454-971-1196", "580-636-8624" }

  26. {"864-260-3570", "415-634-8049", "923-525-9019", "325-833-7887", "979-205-2607", "906-887-2705", "580-832-5099", "033-394-4794", "503-274-0819", "385-333-9635", "468-312-5882", "452-238-9614", "525-544-2832", "913-336-8736"}

    {17, 4, 39, 44, 38, 89, 17, 41, 89, 4, 77, 8, 38, 46}

    3

    Returns: { "906-887-2705", "503-274-0819", "468-312-5882" }

  27. {"135-644-6497", "275-346-1313", "703-276-4552", "631-453-1423", "270-971-1546", "251-179-7978", "912-969-1304", "349-807-9649", "169-130-0724", "484-113-9065", "387-603-1861", "388-380-0404", "695-857-6311", "883-607-9799", "348-451-6856", "739-670-7974", "017-813-9261", "918-628-6283", "027-586-2949", "350-830-6365", "232-826-2302", "558-546-6273", "479-909-8357", "705-235-8896", "510-980-6675", "348-529-7131", "656-564-5344", "495-084-4314", "598-239-4377", "455-051-0522", "056-980-4042", "672-719-5429", "375-655-8496", "611-104-0413", "277-217-3054", "054-651-6133"}

    {33, 77, 61, 77, 77, 33, 77, 77, 86, 86, 33, 33, 61, 33, 33, 33, 77, 77, 86, 61, 61, 33, 86, 61, 77, 86, 77, 61, 33, 86, 77, 77, 33, 86, 61, 42}

    29

    Returns: { "169-130-0724", "484-113-9065", "027-586-2949", "479-909-8357", "348-529-7131", "455-051-0522", "611-104-0413", "275-346-1313", "631-453-1423", "270-971-1546", "912-969-1304", "349-807-9649", "017-813-9261", "918-628-6283", "510-980-6675", "656-564-5344", "056-980-4042", "672-719-5429", "703-276-4552", "695-857-6311", "350-830-6365", "232-826-2302", "705-235-8896", "495-084-4314", "277-217-3054", "054-651-6133", "135-644-6497", "251-179-7978", "387-603-1861" }

  28. {"232-280-9554", "650-804-0489", "229-980-5971", "483-938-1215", "315-307-1380", "470-752-5464", "922-213-0657", "832-632-5752", "253-203-6259", "501-952-9822", "673-132-6048", "732-750-8533", "857-068-9669", "098-806-5909", "125-787-1415", "949-179-7212", "617-139-6481", "907-426-5947", "723-389-5247", "187-607-9318", "014-920-4192", "115-402-1769", "334-853-2123", "020-425-0599", "949-729-4310", "921-542-0392", "955-734-7826", "167-432-6137", "840-831-6276", "087-205-5676"}

    {68, 42, 80, 95, 20, 49, 14, 24, 96, 21, 41, 79, 90, 90, 51, 9, 14, 77, 51, 9, 17, 21, 77, 51, 77, 56, 41, 68, 41, 94}

    14

    Returns: { "253-203-6259", "483-938-1215", "087-205-5676", "857-068-9669", "098-806-5909", "229-980-5971", "732-750-8533", "907-426-5947", "334-853-2123", "949-729-4310", "232-280-9554", "167-432-6137", "921-542-0392", "125-787-1415" }

  29. {"709-177-0193", "855-385-4455"}

    {72, 72}

    2

    Returns: { "709-177-0193", "855-385-4455" }

  30. {"464-742-7002", "419-529-4789", "562-950-9567", "935-561-5251", "202-448-0877", "234-343-5659", "434-541-8750", "860-170-5064", "073-726-9944", "396-101-3518", "377-536-9435", "783-980-6944", "962-142-0570", "360-726-9919", "385-309-5654", "603-034-1397", "109-863-7597", "590-299-8405", "543-151-3451", "523-448-9029", "769-103-9952"}

    {98, 87, 89, 87, 33, 89, 3, 87, 98, 89, 3, 3, 98, 33, 89, 98, 10, 3, 10, 3, 3}

    18

    Returns: { "464-742-7002", "073-726-9944", "962-142-0570", "603-034-1397", "562-950-9567", "234-343-5659", "396-101-3518", "385-309-5654", "419-529-4789", "935-561-5251", "860-170-5064", "202-448-0877", "360-726-9919", "109-863-7597", "543-151-3451", "434-541-8750", "377-536-9435", "783-980-6944" }

  31. {"457-972-4612", "978-000-3075", "709-581-1982", "048-103-1435", "398-279-8479", "271-386-2672", "309-861-0110", "890-305-3925", "326-927-1007", "750-263-4834", "959-746-7164", "058-661-1218", "382-251-8517", "246-762-1600", "817-588-4895", "574-709-7720", "013-054-2460", "362-074-5278", "294-283-5350", "054-933-5256", "082-273-5513", "987-742-1774", "417-120-4991", "856-239-2006", "922-036-9980", "098-249-9884", "472-233-6470", "096-118-6138", "212-567-7910", "917-718-0275"}

    {87, 72, 97, 77, 72, 94, 81, 60, 87, 60, 60, 77, 87, 72, 60, 94, 94, 97, 94, 87, 72, 87, 97, 97, 94, 97, 94, 77, 94, 94}

    28

    Returns: { "709-581-1982", "362-074-5278", "417-120-4991", "856-239-2006", "098-249-9884", "271-386-2672", "574-709-7720", "013-054-2460", "294-283-5350", "922-036-9980", "472-233-6470", "212-567-7910", "917-718-0275", "457-972-4612", "326-927-1007", "382-251-8517", "054-933-5256", "987-742-1774", "309-861-0110", "048-103-1435", "058-661-1218", "096-118-6138", "978-000-3075", "398-279-8479", "246-762-1600", "082-273-5513", "890-305-3925", "750-263-4834" }

  32. {"747-975-5480", "747-846-5115", "019-184-9107", "560-489-6000", "785-004-5779", "045-574-5256", "855-285-6063", "636-435-8012", "755-901-9837", "165-151-5787", "429-406-3493", "823-340-6281", "762-553-4395", "634-452-9690", "367-355-5004", "730-664-4226", "554-936-0437", "979-448-1898", "475-494-9178", "683-060-3153", "256-381-4162", "994-062-9336", "735-772-0588", "911-878-4882", "015-893-8597", "591-435-9488", "864-018-5399"}

    {40, 64, 2, 56, 40, 85, 40, 38, 85, 73, 73, 42, 38, 92, 19, 8, 23, 38, 99, 23, 92, 73, 38, 42, 8, 67, 73}

    6

    Returns: { "475-494-9178", "634-452-9690", "256-381-4162", "045-574-5256", "755-901-9837", "165-151-5787" }

  33. {"883-067-6648", "301-133-3635", "472-749-5258", "479-143-0817", "292-030-2662", "678-151-3610", "536-134-0930", "700-402-6601", "726-785-5158"}

    {17, 75, 44, 17, 75, 17, 17, 17, 75}

    8

    Returns: { "301-133-3635", "292-030-2662", "726-785-5158", "472-749-5258", "883-067-6648", "479-143-0817", "678-151-3610", "536-134-0930" }

  34. {"424-682-0716", "576-679-3502", "048-481-5590", "083-130-2652", "413-642-2280", "885-635-7354", "602-363-2650", "146-423-1445", "405-803-8342", "927-105-7699", "207-276-7099", "900-166-0035", "721-744-4704", "833-893-9307", "312-039-3461", "394-862-6040", "919-648-5655", "779-183-8446", "860-512-8838", "923-850-2195", "746-135-1898", "496-261-8186", "964-576-0052"}

    {85, 83, 60, 83, 78, 78, 54, 84, 85, 47, 54, 27, 73, 89, 73, 27, 61, 27, 60, 60, 89, 27, 60}

    17

    Returns: { "833-893-9307", "746-135-1898", "424-682-0716", "405-803-8342", "146-423-1445", "576-679-3502", "083-130-2652", "413-642-2280", "885-635-7354", "721-744-4704", "312-039-3461", "919-648-5655", "048-481-5590", "860-512-8838", "923-850-2195", "964-576-0052", "602-363-2650" }

  35. {"495-654-0382", "725-239-6186", "323-177-2151", "982-930-6049", "237-495-6474", "225-131-0232", "047-352-9383", "392-043-6923", "052-513-4367", "940-950-5142", "370-753-4724", "980-471-1185", "906-553-7742", "294-310-3382", "955-139-0567", "936-759-5897", "182-090-5897", "881-704-5279", "384-286-8352"}

    {5, 48, 97, 33, 5, 97, 36, 48, 24, 36, 14, 5, 5, 13, 33, 24, 14, 60, 14}

    7

    Returns: { "323-177-2151", "225-131-0232", "881-704-5279", "725-239-6186", "392-043-6923", "047-352-9383", "940-950-5142" }

  36. {"016-205-1343", "632-936-1174", "743-191-4207", "351-685-7435", "031-878-0102", "580-705-5899", "516-727-1965", "094-602-6847", "014-042-5353", "224-157-7678", "720-748-5625", "535-239-6861", "633-025-4099", "151-130-1160", "452-048-7113", "929-889-9434", "321-982-1306"}

    {42, 14, 70, 45, 45, 55, 91, 36, 55, 42, 84, 53, 89, 65, 53, 56, 89}

    14

    Returns: { "516-727-1965", "633-025-4099", "321-982-1306", "720-748-5625", "743-191-4207", "151-130-1160", "929-889-9434", "580-705-5899", "014-042-5353", "535-239-6861", "452-048-7113", "351-685-7435", "031-878-0102", "016-205-1343" }

  37. {"434-523-7640", "336-354-9941", "652-563-1207", "974-795-8230", "248-282-5737", "891-281-8067", "906-972-2875", "694-307-7279", "765-977-6121", "698-865-7763", "056-577-9183", "490-352-5951", "722-009-4018", "473-321-8075", "315-966-1992", "138-757-9333", "587-627-2324", "682-935-4285", "329-406-1023", "729-502-9493", "593-298-3642", "996-546-8378", "150-796-0665", "294-226-2429", "140-891-0352"}

    {90, 26, 8, 90, 26, 85, 97, 8, 26, 59, 25, 50, 97, 85, 8, 97, 85, 8, 50, 25, 25, 50, 85, 85, 85}

    25

    Returns: { "906-972-2875", "722-009-4018", "138-757-9333", "434-523-7640", "974-795-8230", "891-281-8067", "473-321-8075", "587-627-2324", "150-796-0665", "294-226-2429", "140-891-0352", "698-865-7763", "490-352-5951", "329-406-1023", "996-546-8378", "336-354-9941", "248-282-5737", "765-977-6121", "056-577-9183", "729-502-9493", "593-298-3642", "652-563-1207", "694-307-7279", "315-966-1992", "682-935-4285" }

  38. {"149-164-8549", "236-884-8798", "893-659-8202", "807-210-3396", "214-814-5461", "535-003-6829", "735-541-3974", "452-160-1873", "487-924-2477", "897-457-1669", "836-508-9837", "031-101-0814", "167-220-3001", "934-056-0800", "926-280-6638", "195-601-6859", "455-290-8010", "908-053-0194", "566-300-3707", "527-301-7545", "539-094-1976", "523-044-8040", "297-746-4816", "638-632-6201", "763-627-9207", "435-989-6414", "753-034-2476"}

    {63, 43, 88, 84, 50, 25, 88, 73, 16, 38, 17, 74, 81, 29, 25, 50, 76, 76, 4, 43, 81, 29, 4, 76, 76, 29, 63}

    9

    Returns: { "893-659-8202", "735-541-3974", "807-210-3396", "167-220-3001", "539-094-1976", "455-290-8010", "908-053-0194", "638-632-6201", "763-627-9207" }

  39. {"547-326-7765", "201-941-5355", "777-919-5034", "416-638-0133", "709-739-5534", "965-091-7608", "636-591-5458", "374-091-5770", "909-192-3366", "183-970-2611", "375-576-0839", "096-736-9404", "884-104-9864", "443-996-5921", "067-440-1876", "885-098-2894", "022-189-7530", "510-246-1895", "268-600-5636", "120-895-5949", "138-137-7248", "972-687-1020", "021-531-3826", "708-350-3298", "290-497-3776", "246-718-7217", "675-617-3229", "688-376-2393", "758-202-8978"}

    {47, 94, 3, 77, 100, 33, 87, 99, 96, 10, 4, 99, 17, 4, 47, 4, 11, 10, 11, 89, 100, 94, 92, 77, 77, 3, 67, 67, 10}

    27

    Returns: { "709-739-5534", "138-137-7248", "374-091-5770", "096-736-9404", "909-192-3366", "201-941-5355", "972-687-1020", "021-531-3826", "120-895-5949", "636-591-5458", "416-638-0133", "708-350-3298", "290-497-3776", "675-617-3229", "688-376-2393", "547-326-7765", "067-440-1876", "965-091-7608", "884-104-9864", "022-189-7530", "268-600-5636", "183-970-2611", "510-246-1895", "758-202-8978", "375-576-0839", "443-996-5921", "885-098-2894" }

  40. {"820-268-3168", "576-577-1328", "341-740-3904", "923-134-0222", "861-941-2751", "799-003-5230", "375-872-4070", "229-217-8260", "219-527-7115", "512-522-6318", "950-710-6722", "182-259-9941", "338-217-3153", "190-879-9141", "101-800-0884", "259-640-2416", "695-068-3339", "900-684-0415", "718-241-2077", "834-221-4320", "373-827-5338", "491-248-5350", "495-508-2293", "940-557-3073", "606-276-4664", "571-887-2203", "944-736-1498"}

    {100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100}

    20

    Returns: { "820-268-3168", "576-577-1328", "341-740-3904", "923-134-0222", "861-941-2751", "799-003-5230", "375-872-4070", "229-217-8260", "219-527-7115", "512-522-6318", "950-710-6722", "182-259-9941", "338-217-3153", "190-879-9141", "101-800-0884", "259-640-2416", "695-068-3339", "900-684-0415", "718-241-2077", "834-221-4320" }

  41. {"486-339-9840", "248-189-1807", "341-281-3067", "718-913-9318", "662-353-2143", "976-611-6067", "986-785-0503", "329-557-5243", "535-499-6899", "463-374-9331", "977-027-9607", "533-065-9755", "174-317-1254", "034-692-8470", "087-626-0265", "169-371-2012", "508-366-2580", "281-338-9171", "334-010-4846", "592-478-7219", "072-245-0541", "171-468-4842", "063-583-6803", "148-605-7404", "181-178-0467"}

    {3, 3, 61, 63, 61, 53, 3, 32, 92, 56, 32, 32, 63, 3, 92, 3, 56, 32, 92, 61, 53, 32, 68, 68, 53}

    23

    Returns: { "535-499-6899", "087-626-0265", "334-010-4846", "063-583-6803", "148-605-7404", "718-913-9318", "174-317-1254", "341-281-3067", "662-353-2143", "592-478-7219", "463-374-9331", "508-366-2580", "976-611-6067", "072-245-0541", "181-178-0467", "329-557-5243", "977-027-9607", "533-065-9755", "281-338-9171", "171-468-4842", "486-339-9840", "248-189-1807", "986-785-0503" }

  42. {"668-141-2289", "632-487-2508", "418-735-7318", "304-948-6008", "194-157-0816", "368-373-9242", "149-965-3439", "214-568-8570", "337-005-3465", "857-652-8604", "312-235-2394", "482-132-0399", "645-066-1232", "899-282-4146", "492-161-4894", "178-342-2208", "160-916-0471", "065-220-2314", "672-888-9006", "169-034-9305", "038-736-3398", "733-519-9033", "152-875-2816", "454-098-6827", "722-681-7449", "741-336-7164", "472-775-2074"}

    {22, 64, 67, 57, 12, 68, 89, 90, 89, 89, 66, 8, 15, 22, 93, 91, 99, 90, 37, 20, 91, 20, 6, 66, 37, 79, 79}

    5

    Returns: { "160-916-0471", "492-161-4894", "178-342-2208", "038-736-3398", "214-568-8570" }

  43. {"481-012-6724", "014-379-7801", "000-992-4866", "024-636-9231", "168-076-3857", "552-497-8642", "748-453-4382", "494-915-7740", "933-671-5207", "808-760-6757", "216-732-2714", "335-403-7235", "127-203-7475", "088-415-1960", "901-175-1341", "160-820-3086", "771-211-9137", "456-237-4025", "586-515-8950", "261-100-1589", "646-505-6032", "537-161-6223", "123-081-6287"}

    {68, 50, 59, 31, 81, 82, 84, 55, 55, 36, 82, 36, 55, 15, 75, 13, 75, 55, 55, 84, 84, 94, 54}

    21

    Returns: { "537-161-6223", "748-453-4382", "261-100-1589", "646-505-6032", "552-497-8642", "216-732-2714", "168-076-3857", "901-175-1341", "771-211-9137", "481-012-6724", "000-992-4866", "494-915-7740", "933-671-5207", "127-203-7475", "456-237-4025", "586-515-8950", "123-081-6287", "014-379-7801", "808-760-6757", "335-403-7235", "024-636-9231" }

  44. {"486-841-0091", "364-754-7397", "023-500-6283", "199-679-8612", "699-143-4469", "044-137-6946", "954-254-5184", "439-582-1519", "218-262-2205", "475-667-6393", "047-773-3840", "037-319-3263", "884-553-5773", "683-029-4572", "867-832-7294", "442-751-2771", "202-618-0543", "605-931-0069", "737-564-0845", "869-037-6670", "704-546-0298", "547-829-1921", "313-010-4960", "097-740-4084", "080-962-3137", "248-857-2298", "532-913-7530", "192-414-9352", "351-494-6552", "890-319-7348", "785-135-8335"}

    {75, 91, 99, 28, 99, 12, 4, 91, 92, 38, 65, 16, 95, 23, 34, 95, 57, 91, 35, 88, 99, 91, 99, 26, 58, 4, 23, 26, 92, 35, 90}

    25

    Returns: { "023-500-6283", "699-143-4469", "704-546-0298", "313-010-4960", "884-553-5773", "442-751-2771", "218-262-2205", "351-494-6552", "364-754-7397", "439-582-1519", "605-931-0069", "547-829-1921", "785-135-8335", "869-037-6670", "486-841-0091", "047-773-3840", "080-962-3137", "202-618-0543", "475-667-6393", "737-564-0845", "890-319-7348", "867-832-7294", "199-679-8612", "097-740-4084", "192-414-9352" }

  45. {"977-289-2077", "082-047-4910", "718-714-6084", "697-554-2516", "757-211-7100", "681-051-1720", "684-622-9423", "668-485-6662", "894-101-0740", "403-158-9806", "165-800-0988", "811-996-4941", "178-719-5855", "458-047-4114", "014-144-6827"}

    {80, 52, 64, 4, 47, 51, 64, 49, 52, 51, 51, 42, 51, 80, 49}

    8

    Returns: { "977-289-2077", "458-047-4114", "718-714-6084", "684-622-9423", "082-047-4910", "894-101-0740", "681-051-1720", "403-158-9806" }

  46. {"109-981-0148", "008-567-0504", "962-357-6937", "301-333-8849", "097-722-6258", "988-090-5606", "750-044-4448", "829-103-7115", "251-881-7610", "082-521-8625", "279-005-7188", "814-333-3608", "068-640-8655", "305-711-2417", "494-434-1751", "058-362-7059", "468-922-6523", "471-038-7333", "456-809-9731", "220-082-9782", "369-545-1330", "672-638-9324", "414-632-7881", "767-822-7223", "487-817-2126", "559-959-1330", "343-126-4201", "594-421-4034", "304-995-2311", "176-028-7724", "334-623-7382", "103-677-7204", "276-707-2189", "113-951-9473"}

    {85, 93, 16, 63, 79, 24, 37, 51, 24, 49, 93, 23, 63, 10, 23, 41, 23, 41, 50, 46, 49, 61, 51, 10, 49, 93, 51, 37, 23, 37, 16, 99, 16, 50}

    32

    Returns: { "103-677-7204", "008-567-0504", "279-005-7188", "559-959-1330", "109-981-0148", "097-722-6258", "301-333-8849", "068-640-8655", "672-638-9324", "829-103-7115", "414-632-7881", "343-126-4201", "456-809-9731", "113-951-9473", "082-521-8625", "369-545-1330", "487-817-2126", "220-082-9782", "058-362-7059", "471-038-7333", "750-044-4448", "594-421-4034", "176-028-7724", "988-090-5606", "251-881-7610", "814-333-3608", "494-434-1751", "468-922-6523", "304-995-2311", "962-357-6937", "334-623-7382", "276-707-2189" }

  47. {"006-159-9946"}

    {63}

    1

    Returns: { "006-159-9946" }

  48. {"463-709-5174", "925-988-3010", "387-127-1078", "473-081-9540", "798-598-5827", "015-823-5347", "763-934-1349", "749-127-2571", "636-457-1242", "985-968-2626", "348-162-0685", "400-473-0112", "204-312-4167", "905-776-4984", "441-074-9046", "378-584-2432", "957-886-1975", "777-672-4814", "689-503-3049", "895-018-1378", "668-770-4004", "894-458-0457", "705-079-8129", "902-873-0562", "537-503-5527", "988-710-9846", "750-969-1453", "683-092-0702", "923-684-8814", "985-043-4271", "291-398-4741", "364-470-7594", "092-792-7399", "501-648-8238", "072-194-8267", "417-511-2456", "977-902-6681", "933-287-7152", "714-423-9226", "751-242-8767", "893-731-6595", "222-888-3247", "946-635-1031", "173-989-1316", "971-592-3153", "854-518-2694", "831-671-4311", "856-808-6197"}

    {33, 16, 97, 97, 48, 27, 33, 33, 45, 48, 13, 12, 16, 88, 6, 97, 48, 12, 92, 43, 13, 43, 25, 92, 25, 27, 43, 16, 43, 27, 18, 13, 54, 43, 6, 54, 16, 48, 33, 27, 92, 54, 33, 12, 33, 45, 18, 6}

    44

    Returns: { "387-127-1078", "473-081-9540", "378-584-2432", "689-503-3049", "902-873-0562", "893-731-6595", "905-776-4984", "092-792-7399", "417-511-2456", "222-888-3247", "798-598-5827", "985-968-2626", "957-886-1975", "933-287-7152", "636-457-1242", "854-518-2694", "895-018-1378", "894-458-0457", "750-969-1453", "923-684-8814", "501-648-8238", "463-709-5174", "763-934-1349", "749-127-2571", "714-423-9226", "946-635-1031", "971-592-3153", "015-823-5347", "988-710-9846", "985-043-4271", "751-242-8767", "705-079-8129", "537-503-5527", "291-398-4741", "831-671-4311", "925-988-3010", "204-312-4167", "683-092-0702", "977-902-6681", "348-162-0685", "668-770-4004", "364-470-7594", "400-473-0112", "777-672-4814" }

  49. {"756-109-4569", "909-517-1424", "532-943-6613", "446-548-1684", "386-981-2092", "089-552-4660", "582-488-9383", "317-974-9779", "683-637-8189", "321-097-3852", "945-415-7508", "258-406-8703", "134-924-8492", "636-284-4649", "456-361-0731", "799-234-2030", "604-855-6953", "208-245-5117", "451-789-1371", "437-225-0495", "808-281-2442", "432-736-0631", "467-954-2134", "121-295-3260", "543-113-6562", "955-180-6677", "839-223-9124", "437-510-2732", "384-495-1368", "228-587-8475", "486-415-0004", "530-638-7273", "575-315-7600", "338-192-6963", "772-117-3563"}

    {45, 88, 98, 82, 35, 53, 40, 52, 66, 27, 66, 10, 56, 62, 67, 89, 29, 37, 62, 66, 99, 52, 41, 62, 89, 89, 71, 89, 28, 17, 40, 81, 35, 99, 56}

    26

    Returns: { "808-281-2442", "338-192-6963", "532-943-6613", "799-234-2030", "543-113-6562", "955-180-6677", "437-510-2732", "909-517-1424", "446-548-1684", "530-638-7273", "839-223-9124", "456-361-0731", "683-637-8189", "945-415-7508", "437-225-0495", "636-284-4649", "451-789-1371", "121-295-3260", "134-924-8492", "772-117-3563", "089-552-4660", "317-974-9779", "432-736-0631", "756-109-4569", "467-954-2134", "582-488-9383" }

  50. {"005-983-7472", "114-686-5671", "547-258-9216", "498-927-7588", "473-655-3321", "136-497-8689", "548-522-1172", "454-660-9295", "759-673-3581", "286-624-5333", "377-796-4470", "981-917-5596", "124-194-9412", "034-613-2866", "587-093-1047", "885-779-8544", "649-231-1113", "961-220-0750", "148-545-6077", "825-787-5818", "663-542-8829", "061-641-3448", "068-327-3467", "752-434-0262", "148-379-8188", "490-378-3257", "355-018-7075", "537-041-3702", "903-424-5780", "510-041-2234"}

    {13, 96, 33, 31, 38, 38, 80, 47, 84, 96, 27, 2, 2, 47, 33, 22, 89, 80, 30, 13, 96, 32, 13, 52, 11, 31, 29, 29, 52, 52}

    4

    Returns: { "114-686-5671", "286-624-5333", "663-542-8829", "649-231-1113" }

  51. { "123-456-7890", "012-333-4455", "800-825-6699", "333-333-3333" }

    { 3, 3, 1, 1 }

    3

    Returns: { "123-456-7890", "012-333-4455", "800-825-6699" }

  52. { "100-000-1000", "200-200-2000", "300-000-2000", "100-020-2000", "900-990-1000" }

    { 1, 3, 5, 6, 7 }

    2

    Returns: { "900-990-1000", "100-020-2000" }

  53. { "123-456-7890", "012-333-4455", "800-825-6699", "333-333-3333" }

    { 3, 1, 3, 3 }

    2

    Returns: { "123-456-7890", "800-825-6699" }

  54. { "111-111-1111", "222-222-2222", "333-333-3333" }

    { 1, 2, 3 }

    3

    Returns: { "333-333-3333", "222-222-2222", "111-111-1111" }

  55. { "123-456-7890", "012-333-4455", "800-825-6699" }

    { 3, 2, 1 }

    3

    Returns: { "123-456-7890", "012-333-4455", "800-825-6699" }

  56. { "123-456-7890", "321-456-9878" }

    { 100, 90 }

    1

    Returns: { "123-456-7890" }


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: