Open harshraj8843 opened 8 months ago
👋🏻 Hey @harshraj8843
💖 Thanks for opening this issue 💖
A team member should be by to give feedback soon.
!assign
Hey @srivamsidandu, this issue is already assigned to @zackbmz! cc/ @codinasion/codinasion
void moveZeroesToEnd(std::vector
// Iterate through the vector and move non-zero elements to the beginning
for (int num : nums) {
if (num != 0) {
nums[nonZeroIndex++] = num;
}
}
// Fill the remaining elements with zeroes
while (nonZeroIndex < nums.size()) {
nums[nonZeroIndex++] = 0;
}
}
int main() {
std::vector
moveZeroesToEnd(nums);
std::cout << "Array after moving zeroes to the end:" << std::endl;
for (int num : nums) {
std::cout << num << " ";
}
std::cout << std::endl;
return 0; }
Description
Write a C# program to find the smallest three elements in an array
How to contribute
- Comment `!assign` to assign this issue to yourself - Fork this repository - Create a new branch - Save the solution in `program/program/find-the-smallest-three-elements-in-an-array/FindTheSmallestThreeElementsInAnArray.cs` - Commit the changes - Create a pull request