Pattern-16 | Solution | Java Foundation Course

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ธ.ค. 2024

ความคิดเห็น • 19

  • @rohit.1232
    @rohit.1232 3 ปีที่แล้ว +3

    thank u sir its ur free resource course is really helping

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว +1

      Glad to hear that and If you like the content could you post something on LinkedIn about us? This will help us in reaching out to more people and help a lot of other students as well
      Something like this
      Sumeet Malik from Pepcoding is making all his content freely available to the community
      You can check it out here - www.pepcoding.com/resources
      /
      Also, this is the youtube channel - th-cam.com/users/Pepcodingplaylists?view_as=subscriber

  • @deepanshukhorwal8938
    @deepanshukhorwal8938 3 ปีที่แล้ว

    sir you teach very well thankyou so much sir for this playlist

  • @iffyaiyan8942
    @iffyaiyan8942 4 ปีที่แล้ว

    Thanks for the wonderful content,
    You are really a gem Sir!

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +3

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.

  • @biswajeet9826
    @biswajeet9826 4 หลายเดือนก่อน +1

    How is it 2n-3

  • @rajatmakkar4465
    @rajatmakkar4465 ปีที่แล้ว

    Thanks sir❤

  • @teknas8953
    @teknas8953 4 ปีที่แล้ว +1

    I came up with following solution , though it works in eclipse but in pepcoding editor when submitted is says wrong answer , can you just validate this ?
    import java.util.*;
    public class Main{
    public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    // write ur code here



    int n = scn.nextInt();
    int size = (n * 2) - 1;
    int temp = 1;
    int space = size - 2;
    int star = 1;
    int star2 = 1;
    for (int i = 1; i

  • @sakshiaggarwal6199
    @sakshiaggarwal6199 4 ปีที่แล้ว

    Thanks a lot sir !!

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +1

      All thanks to you people🙏🏼
      With the love and respect which Pepcoding is getting from you people, we are able to make all this content.

  • @saikarthik2224
    @saikarthik2224 3 ปีที่แล้ว

    I printed the second part in reverse...
    Scanner sc = new Scanner(System.in);
    int size = sc.nextInt();

    int sp = 2*size -3;

    for(int i = 1; i

  • @ajitpatil7214
    @ajitpatil7214 ปีที่แล้ว

    better approach
    import java.util.*;
    class pattern16 {
    public static void main(String[] args) {
    System.out.println(" Enter a number ");
    Scanner scn = new Scanner(System.in);
    int num = scn.nextInt();
    int n = 1;
    int sp = num + 1;
    for (int i = 1; i

  • @adarshjain605
    @adarshjain605 5 หลายเดือนก่อน

    my approch of doing it
    public class PaternQ16 {
    public static void main(String[] args) {
    int n = 4;
    int m = 2*n - 3;
    for (int i = 0; i < n; i++) {
    int x = 0;
    for (int j = 1; j < 2 * (n); j++) {
    if (j

  • @_rahulsain
    @_rahulsain 4 ปีที่แล้ว

    es ques mei thodi dikkat aayi approach me

    • @_rahulsain
      @_rahulsain 4 ปีที่แล้ว

      ho gya solved:
      import java.util.*;
      public class Main {
      public static void main(String[] args) {
      Scanner scn = new Scanner(System.in);
      int n = scn.nextInt();
      int sp = 2 * n - 3;
      for (int i = 0; i < n; i++) {
      int temp = 0;
      int stp = sp;
      for (int j = 0; j < 2 * n - 1; j++) {
      if (j 0) {
      System.out.print("\t");
      stp--;
      } else {
      if (temp == n) {
      temp--;
      }
      System.out.print(temp-- + "\t");
      }
      }
      sp -= 2;
      System.out.println();
      }
      }
      }