LeetCode 面试题08.03. 魔术索引
2020-07-31 20:21
549 查看
面试题08.03. 魔术索引
/** *思路: *这题方法很多,这里我想到的是暴力破解,最差的情况下便利所有数*组。最好是使用分治算法,左右都有可能有的情况下,不可以使用二*分算法 */ class Solution { public int findMagicIndex(int[] nums) { for(int i = 0;i < nums.length;i++){ if(i == nums[i]){ return i; } } return -1; } }
相关文章推荐
- leetcode面试题 08.03. 魔术索引(二分)
- 面试题(魔术索引)
- leetcode微软面试题20.Valid Parentheses
- leetcode 面试题44 数字序列中某一位的数字
- 【Golang】LeetCode-剑指Offer-面试题44-数字序列中某一位的数字
- 【Golang】LeetCode-剑指Offer-面试题13-机器人的运动范围
- 【Golang】LeetCode-剑指Offer-面试题53 - II-0~n-1中缺失的数字【四种解法】
- 【Golang】LeetCode-剑指Offer-面试题18-删除链表的节点
- 剑指Offer面试题7 & Leetcode232
- 剑指Offer面试题19 & Leetcode226
- 剑指offer 面试题34:寻找丑数(Leetcode 263.ugly number)解题报告
- leetcode每日一题——面试题 10.01. 合并排序的数组
- leetcode谷歌面试题279. Perfect Squares
- LeetCode 剑指Offer 面试题27. 二叉树的镜像
- 面试题8:旋转数组的最小值(Leetcode-153,154)
- 剑指offer 面试题19:二叉树的镜像(leetcode226. Invert Binary Tree) 题解
- Max Points on a Line --- LeetCode 面试题
- (刷题笔记)Leetcode 面试题 17.12. BiNode
- 2014阿里实习生面试题——MySQL如何实现索引的
- leetcode面试题 02.08. 环路检测