Entringer Number | JAVA Code For Entringer Number ; Return Entringer Number E ( n , k ) ; Base Case ; Base Case ; Recursive step ; Driver program to test above function
import java . util . * ; class GFG { static int zigzag ( int n , int k ) { if ( n == 0 && k == 0 ) return 1 ; if ( k == 0 ) return 0 ; return zigzag ( n , k - 1 ) + zigzag ( n - 1 , n - k ) ; } public static void main ( String [ ] args ) { int n = 4 , k = 3 ; System . out . println ( zigzag ( n , k ) ) ; } }