Please solve the programming task below using a self-contained code snippet in a markdown code block.

Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1.
You must write an algorithm with O(log n) runtime complexity.
 
Please complete the following python code precisely:
```python
class Solution:
    def search(self, nums: List[int], target: int) -> int:
```