title: Update a value of a Array for a given Range
body: <p>have given an array initially having some Max.val value , then there are queries making a update in a Range L,R, such that the value at any position is minimum. For Example:</p>
  
  <pre><code>Update Range 1 3 with value 3 
  Array  3 3 3 Max.val Max.val
  Now update 2 and 4 with 1
  Array  3 1 1 1 Max.val
  Now update 1 and 2 with 2
  Array  2 1 1 1 Max.val
  i.e update only if(A[i]&gt;value) A[i]=value;
  </code></pre>
  
  <p>After the above Query I have to display my final <code>array:i.e 2 1 1 1 Max.val</code></p>
  
  <p>I am using <strong>Segment Tree</strong> to solve this Question but <strong>I am getting TLE(Time limit Exceeded)</strong>. I don't know why ? <strong>My approach is logN.</strong>
  Here is my update function</p>
  
  <pre><code>public static void lets_change(int curr, int[] T, int x, int y, int a, int b, int c) {
      // x=0 and y=n and a=L , b=R and C= Value to be updated
      // T contains Integer.Max_value at start
      if (x &gt; y || b &lt; x || a &gt; y)
          return;
  
      if (x == y) {
          T[curr] = Math.min(T[curr], c);
          return;
      }
      lets_change(2 * curr, T, x, (x + y) / 2, a, b, c);
      lets_change(2 * curr + 1, T, (x + y) / 2 + 1, y, a, b, c);
  
      T[curr] = Math.min(T[2 * curr], T[2 * curr + 1]);
  }
  </code></pre>
  
  <p>Constraints:</p>
  
  <pre><code>N&lt;=10^5;
  Q&lt;=10^5;
  1&lt;L&lt;=R&lt;=10^5
  </code></pre>
  
  <p>What have I done wrong or there is any better way?
  Call a function:</p>
  
  <pre><code>for(int i=0;i&lt;Q;i++){
      int l = in.nextInt()-1;
      int r = in.nextInt()-1;
      int c = in.nextInt();
      lets_change(1,T,0,n-1,l, r,c);
  }
  </code></pre>