develop #1

Open
mahdi_Goudarzi wants to merge 3 commits from develop into main
2 changed files with 18 additions and 4 deletions
Showing only changes of commit ce5e38afc9 - Show all commits
Generated
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="" vcs="Git" />
</component> </component>
</project> </project>
+17 -3
View File
@@ -20,8 +20,21 @@ public class MainExercises
*/ */
public char[][] generateTriangle(int n) { public char[][] generateTriangle(int n) {
// todo char[][] triangle = new char[n][];
return null;
for(int i = 0 ; i < n ; i++){
triangle[i] = new char[i+1];
for(int j = 0 ; j < i+1 ; j++){
if(i == 0 || j == 0 || i== j || i == n-1 ){
triangle[i][j] = '*';
}
else{
triangle[i][j] = ' ';
}
}
}
return triangle;
} }
@@ -57,8 +70,9 @@ public class MainExercises
- Number of rows: matrix.length - Number of rows: matrix.length
- Number of columns: matrix[0].length (if rectangular) - Number of columns: matrix[0].length (if rectangular)
*/ */
public int[] spiralTraversal(int[][] matrix) { public int[] spiralTraversal(int[][] matrix) {
// todo
return null; return null;
} }