code to find length of longest increasing subsequence in an array