public static void computePromotion1(PromotionType1 promotionType1, int customerOrder, bool isFirst, HashSet <char> skuIdSet)
 {
     if (customerOrder >= promotionType1.getTotalItems())
     {
         // Remove from the set as the promotion is applied on this skuId
         if (skuIdSet.contains(promotionType1.getSkuId()))
         {
             skuIdSet.Remove(promotionType1.getSkuId());
         }
         totalPrice    += promotionType1.getPrice();
         customerOrder -= promotionType1.getTotalItems();
         computePromotion1(promotionType1, customerOrder, false, skuIdSet);
     }
     else
     {
         if (isFirst)
         {
             return;
         }
         else
         {
             totalPrice += customerOrder * currentPrice.get(promotionType1.getSkuId());
         }
     }
 }
        public static void BuildPromotionType1Dict(char skuId, int totalItems, int price)
        {
            PromotionType1 promotionType1 = new PromotionType1();

            promotionType1.skuID      = skuId;
            promotionType1.totalItems = totalItems;
            promotionType1.price      = price;

            pt1.Add(skuId, promotionType1);
        }
        public static int CalculateTotalPrice(Dictionary <char, int> items)
        {
            // Prepare the set of SkudIds so that we can remove SkuIds from this set once the promotion is applied
            HashSet <char> skuIdSet = new HashSet <char>();

            foreach (KeyValuePair <char, int> key in items)  // This is foreach loop
            {
                skuIdSet.Add(key);
            }
            // Apply promotion type 1
            foreach (KeyValuePair <char, int> key in items)  //iterating over map
            {
                if (pt1.containsKey(key))
                {
                    PromotionType1 promotionType1 = pt1.key;
                    computePromotion1(promotionType1, items.get(key), true, skuIdSet);
                }
            }

            // Apply promotion type 2
            foreach (KeyValuePair <char, int> key in items)
            {
                if (skuIdSet.contains(key))
                {
                    computePromotion2(skuIdSet, key, items);
                }
            }

            // Remaining SkuIds where no promotion is applied
            foreach (char ch in skuIdSet)
            {
                totalPrice += (items.get(ch) * currentPrice.get(ch));
            }

            return(totalPrice);
        }