-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Spectrum-CETB:main' into main
- Loading branch information
Showing
5 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: bug, hacktoberfest | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Desktop (please complete the following information):** | ||
- OS: [e.g. iOS] | ||
- Browser [e.g. chrome, safari] | ||
- Version [e.g. 22] | ||
|
||
**Smartphone (please complete the following information):** | ||
- Device: [e.g. iPhone6] | ||
- OS: [e.g. iOS8.1] | ||
- Browser [e.g. stock browser, safari] | ||
- Version [e.g. 22] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
# SORT_01 | ||
Q : You are given an array of 0s and 1s in random order. | ||
|
||
Segregate 0s on left side and 1s on right side of the array [Basically you have to sort the array]. | ||
|
||
Input array = [0, 1, 0, 1, 0, 0, 1, 1, 1, 0] | ||
|
||
Output array = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] | ||
|
||
# Problem Explanation 🚀 | ||
It is a sorting of an array in ascending order | ||
|
||
# Your logic 🤯 | ||
* I used the Java util package for it Scanner class for input and Arrays.sort method to sort the array in ascending order. | ||
* Own test cases if any: | ||
* Input array: [0,1,0,1,1,0,0] | ||
* Output array: [0, 0, 0, 0, 1, 1, 1] | ||
|
||
// Time Complexity: O(N log N) | ||
// Auxiliary Space: O(1) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import java.util.Arrays; | ||
class sort { | ||
public static void main(String[] args) | ||
{ | ||
int[] arr ={0,1,0,1,1,0,0}; | ||
|
||
Arrays.sort(arr); | ||
|
||
System.out.printf("Modified arr[] : %s", Arrays.toString(arr)); | ||
} | ||
} |