Deliveroo Interview Question | Data Structure | iOS SSE Interview

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ก.ย. 2024
  • Filter items of dictionary based on array to create a menu for restaurant.
    let menuItems: [String: Double] = ["Burger": 5.99, "Pizza": 8.99, "Pasta": 7.49, "Salad": 4.99, "Soda": 1.99]
    let selectedItems: [String] = ["Burger", "Pizza", "Soda"]

ความคิดเห็น • 4

  • @imagine8882
    @imagine8882 4 หลายเดือนก่อน

    Thanks for sharing such interview questions. Please continue to share such videos, we are getting educate from you.

  • @rajanmaheshwari
    @rajanmaheshwari 2 หลายเดือนก่อน

    The output part you talked about at the end is wrong. In Swift, we always have an unordered dictionary which is output1 in your case. Try running your program more than once and you can see the change in the output. The output preserved in the same order in your video is just a coincidence.

  • @CodeWithGuru
    @CodeWithGuru 4 หลายเดือนก่อน

    Hii, I seen your video what I did not understand How data structure managed in this. Please explain more.

  • @АлексейВоробьёв-ч3ч
    @АлексейВоробьёв-ч3ч 3 หลายเดือนก่อน

    let output1 = Dictionary(uniqueKeysWithValues: selectedItems.compactMap { key in menuItems[key].map { (key, $0) }})