Given a reverse sorted array of integers `nums` (sorted in descending order), and an integer `target`, write a function to search for the `target` in `nums`. If the target exists, return its index. Otherwise, return -1.
{
"nums": [
12,
9,
5,
3,
0,
-1
],
"target": 9
}1{
"nums": [
12,
9,
5,
3,
0,
-1
],
"target": 2
}-1{
"nums": [
5
],
"target": 5
}0Sign in to Run Code and Submit