samisaskinnyqueen
samisaskinnyqueen
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
yeah give me a second
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
same error still
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
so heights.Length-1 then
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
okay that makes sense
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
No description
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
switched it and im still getting that same error ^
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
i need the values, no?
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
No description
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
should i use a for loop?
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
then comparing the new sorted array to the old one to see how many are wrong
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
i need all the values, then i am sorting them smallest to biggest
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
but i dont understand where i am getting a negative index
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
so array would make more sense
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
which option is the best then
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
then why'd you tell me to
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
is that possible
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
should i just make correctOrder the same as heights but in list form in the beginning
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
public class Solution {
public int HeightChecker(int[] heights) {
List<int> correctOrder = new List<int>();
int amountWrong = 0;
foreach(int i in heights) {
int iter = i;
while (iter <= heights.Length){
iter++;
if (heights[i] < heights[iter]) {
int curr = heights[iter-1];
correctOrder.Insert(iter-1, correctOrder[heights[iter-1]]);
correctOrder.Insert(iter, curr);
}
}
}
foreach(int i in heights) {
if(heights[i] != correctOrder[i]){
amountWrong++;
}
}
return amountWrong;
}
}
public class Solution {
public int HeightChecker(int[] heights) {
List<int> correctOrder = new List<int>();
int amountWrong = 0;
foreach(int i in heights) {
int iter = i;
while (iter <= heights.Length){
iter++;
if (heights[i] < heights[iter]) {
int curr = heights[iter-1];
correctOrder.Insert(iter-1, correctOrder[heights[iter-1]]);
correctOrder.Insert(iter, curr);
}
}
}
foreach(int i in heights) {
if(heights[i] != correctOrder[i]){
amountWrong++;
}
}
return amountWrong;
}
}
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
Still the same error
63 replies
CC#
Created by samisaskinnyqueen on 6/10/2024 in #help
How to fix a simple (hopefully) error?
Ill try that real quick'
63 replies