Harry Potter's MIXTURES, Spoj - Dynamic Programming Problem

Поділитися
Вставка
  • Опубліковано 3 жов 2024

КОМЕНТАРІ • 21

  • @ankitkumar-fy2om
    @ankitkumar-fy2om 6 років тому +4

    great explanation of the problem and the best part was real time coding it really helped to understand the concepts

  • @siddheshdeshpande6846
    @siddheshdeshpande6846 5 років тому +1

    Thank you.

  • @harishwarreddy9114
    @harishwarreddy9114 6 років тому +1

    it is analogy to matrix scalar multiplication problem

  • @ManishThakur-jp7zm
    @ManishThakur-jp7zm 4 роки тому +2

    can't thank enough!

  • @harshrajput203
    @harshrajput203 4 роки тому +3

    can anyone tell how to solve this through bottom up approach?

    • @adityaraghav8693
      @adityaraghav8693 3 роки тому

      i am probably late to reply this but for any one looking for bottom up
      ```
      #include
      using namespace std;
      int go( vector A )
      {
      int N = A.size();
      int t[N][N];
      memset( t , 0 , sizeof t);
      int p[N+1];
      memset( p , 0 , sizeof p );
      for( int i = 0 ; i < N ; i++ )
      p[i+1] = ( p[i] + A[i] ) ;
      for( int L = 2 ; L >x;
      V.push_back(x);
      }
      cout

    • @yasser_hussain
      @yasser_hussain 3 роки тому +1

      #include
      #include
      using namespace std;
      int dp[100][100];
      int mixtures[100];
      int prefix[101];
      int main() {
      int n;
      while (cin >> n) {
      for (int i=0; i> mixtures[i];
      for (int i=1; i

  • @gauravchaudhari618
    @gauravchaudhari618 6 років тому

    sum (int i,int j)
    {
    LL total=0;
    for(int k=i; k

  • @gauravchaudhari618
    @gauravchaudhari618 6 років тому

    thanks

  • @srikanthshankar8871
    @srikanthshankar8871 6 років тому +3

    From quora 🙌👌

  • @akashtadwai9471
    @akashtadwai9471 5 років тому +2

    Getting TLE when submitted on SPOJ

    • @het314
      @het314 5 років тому

      try using prefix sum array to compute sum between i and j ...

    • @saurabhgupta1595
      @saurabhgupta1595 3 роки тому

      @Het can you send code

    • @saurabhgupta1595
      @saurabhgupta1595 3 роки тому

      @@het314 can you send code

    • @kunalrastogi6530
      @kunalrastogi6530 Рік тому

      @@saurabhgupta1595
      int dp[101][101];
      int call(vector &A,int i,int j,vector &sum)
      {
      if(i>=j) return dp[i][j]=0;
      if(dp[i][j]!=-1) return dp[i][j];
      int ans=INT_MAX;
      for(int k=i;k

  • @tamannatyagi6285
    @tamannatyagi6285 5 років тому

    Can you provide us the solution URL.

    • @CodingBlocksIndia
      @CodingBlocksIndia  5 років тому +1

      Spoj.com/problems/MIXTURES

    • @tamannatyagi6285
      @tamannatyagi6285 5 років тому +1

      @@CodingBlocksIndia Thanks for this. But I meant the Solution's URL/id.

  • @shantanusingh6699
    @shantanusingh6699 3 роки тому +1

    laut aao prateek bhaiya