'does swapping an elements in an array, considered as modifying an array? LEETCODE - 287
class Solution {
public int findDuplicate(int[] arr) {
List<Integer> arrList = new ArrayList<Integer>();
int i =0;
while(i< arr.length){
if(arr[i]<= arr.length && arr[i] != arr[arr[i]-1]){
int temp = arr[i];
arr[i] = arr[temp-1];
arr[temp-1] = temp;
}
else{
i++;
}
}
for(int j =0; j< arr.length; j++){
if(arr[j] !=j+1){
return arr[j];
}
}
return -1;
}
}
Leetcode - 287 - You must solve the problem without modifying the array nums and uses only constant extra space.
Solution 1:[1]
It's probably the case that you have the wrong interpreter used by Pycharm.
You can configure this here:
Settings -> Project: -> Project Interpreter
Check your installed packages, they should contain the installed Django package, if not, install it there via GUI or via terminal.
This should fix your issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | privateblocks |
