1. Home
  2. >
  3. Easy way to iterate through testcase numbers
3

Easy way to iterate through testcase numbers
Aman Kumar Aman Kumar

Instead of using so long for loop, it can do the trick in less than 25% stroke. TIME is MONEY ;)

# coding shortcut# java# competitive coding# shorthand# loop tricks
class Solution {
      public static void main (String args[]){
        //iterating through testcases
        int T = 10;//storing testcase counter
        while(T-->0)//use T value to compare and then decrement it
        {
          //Perform bussiness logic here:
          System.out.println("T");
        }
      }
    }

Discussions (7)

10

  • 0
  • Reply
Candidate Image

123456789

  • 0
  • Reply
Candidate Image

T

  • 0
  • Reply

T

  • 0
  • Reply

T

  • 0
  • Reply

running T 10 times

  • 0
  • Reply
Candidate Image

Iterated for 10times

  • 0
  • Reply
# coding shortcut# java# competitive coding# shorthand# loop tricks