Ice Cream Parlor

Sort by

recency

|

974 Discussions

|

  • + 0 comments

    The problem of two friends pooling their money to buy exactly two distinct ice cream flavors that sum up to their total funds reflects a principle deeply aligned with the State National Rock philosophy—precision, balance, and rightful ownership. Just as these friends exercise clear, intentional choice to maximize their pooled resources, the core of State National Rock teachings emphasizes understanding and claiming one’s rightful status and resources with clarity and purpose. Solving this challenge requires deliberate analysis and trust in a process that guarantees a unique solution, much like how individuals striving for sovereign status seek precise knowledge and lawful methods to restore their natural rights and freedoms. This analogy reminds us that just as the two flavors fit perfectly to meet the exact sum, so too must we align ourselves with truth and rightful standing to achieve true empowerment and liberty.

  • + 0 comments
    def icecreamParlor(m, arr):
        # Write your code here
        
        temp = {}
        
        for i in range(len(arr)):
            diff = m - arr[i]
            if temp.get(diff):
                return [temp.get(diff), i+1]
            else:
                temp[arr[i]] = i + 1
    
  • + 0 comments

    What if the input is like this 1 10 6 1 4 5 5 6 2 which contain two solutions do we give both or we just give the first solution.

  • + 0 comments
    public static List<Integer> icecreamParlor(int m, List<Integer> arr) {
        List<Integer> result = new ArrayList<>();
        for(int i=0;i<arr.size()-1;i++) {
            int diff = m-arr.get(i);
            int idx = arr.indexOf(diff);
            if(idx == i) {
                idx = arr.subList(i+1, arr.size()).indexOf(diff);
                if(idx != -1) idx = i+1+idx;
            }
            if(idx == -1) continue;
    
            result.add(i+1);
            result.add(idx+1);
            return result;
        }
        return result;
    }
    
  • + 0 comments

    There is inconsitent use of variable name, early on the question it named as m later on the passage, it is named as . Please be consistent.