Public Class Form1
Dim s = {1, 6, 3, 4, 8, 5, 2, 7, 9}
Dim ll(8) As Integer
Sub lis()
For i = 0 To UBound(s) 'Ubound = length -1
ll(i) = 1
Next
For i = 0 To UBound(s)
For j = i + 1 To UBound(s)
If s(i) < s(j) Then
ll(j) = Math.Max(ll(j), ll(i) + 1)
End If
Next
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lis()
MsgBox(ll.Max)
End Sub
End Class
沒有留言:
張貼留言