Sort by

recency

|

132 Discussions

|

  • + 0 comments

    That the task was mentioning the input format was not necessary and thus confusing! First problem I solved.

  • + 0 comments

    trying to understand this question is making me vomiting blood

  • + 0 comments
    template <bool...digits>
    int reversed_binary_value(){
        bool arr[] = {digits...};
        int sum = 0;
        int a = 0;
        for(bool i : arr){
            sum = sum | ((1&i) << a++);
        }
        return sum;
    }
    
  • + 0 comments

    This is a stupid example, doesn't make any sense

  • + 0 comments
    template <bool... digits> 
    int reversed_binary_value(){
        std::vector<int> parameterPack = {digits...};
        //std::reverse(parameterPack.begin(), parameterPack.end());
        int a = 0;
        int sum = 0;
        for (bool i : parameterPack)
        {
            sum = sum + std::pow(2,a)*i;
            a++;
        }
        return sum;
    }