leetcode

Leetcode submissions
git clone git://git.laack.co/leetcode.git
Log | Files | Refs | README

search-in-roatated-array.dart (365B)


      1 //Given a rotated array find the index of the target value.
      2 //If there are no instances then return -1.
      3 //Time: 297ms Beats: 36%
      4 //Memory: 143.3MB Beats: 56%
      5 
      6 class Solution {
      7   int search(List<int> nums, int target) {
      8       for(int i = 0 ; i < nums.length ; ++i){
      9           if(nums[i] == target){
     10               return i;
     11           }
     12       }
     13       return -1;
     14   }
     15 }