codeparrot/xlcost-text-to-code huggingface dataset:
Largest Ratio Contiguous subarray | C # program for the above approach ; Function to return maximum of two double values ; Check if a is greater than b then return a ; Function that returns the Ratio of max Ratio subarray ; Variable to store the maximum ratio ; Compute the product while traversing for subarrays ; Calculate the ratio ; Update max ratio ; Print the answer ; Driver code
using System ; class GFG { static double maximum ( double a , double b ) { if ( a > b ) return a ; return b ; } static double maxSubarrayRatio ( double [ ] arr , int n ) { double maxRatio = int . MinValue ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { double ratio = arr [ i ] ; for ( int k = i + 1 ; k <= j ; k ++ ) { ratio = ratio / arr [ k ] ; } maxRatio = maximum ( maxRatio , ratio ) ; } } return maxRatio ; } public static void Main ( String [ ] args ) { double [ ] arr = { 2 , 2 , 4 , - 0.2 , - 1 } ; int n = arr . Length ; Console . WriteLine ( maxSubarrayRatio ( arr , n ) ) ; } }
Even Perfect Number | C # program for the above approach ; Function to check for perfect number ; Find a number close to 2 ^ q - 1 ; Calculate q - 1 ; Condition of perfect number ; Check whether q is prime or not ; Check whether 2 ^ q - 1 is a prime number or not ; Function to check for prime number ; Check whether it is equal to 2 or 3 ; Check if it can be divided by 2 and 3 then it is not prime number ; Check whether the given number be divide by other prime numbers ; Driver code
using System ; using System . Collections . Generic ; class GFG { private static void check ( long num ) { long root = ( long ) Math . Sqrt ( num ) ; long pow = ( long ) ( Math . Log ( root ) / Math . Log ( 2 ) ) ; if ( num == ( long ) ( Math . Pow ( 2 , pow ) * ( Math . Pow ( 2 , pow + 1 ) - 1 ) ) ) { if ( isPrime ( pow + 1 ) ) { if ( isPrime ( ( long ) Math . Pow ( 2 , pow + 1 ) - 1 ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } else Console . WriteLine ( " No " ) ; } else Console . WriteLine ( " No " ) ; } public static bool isPrime ( long n ) { if ( n <= 1 ) return false ; else if ( n == 2 n == 3 ) return true ; else { if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( long i = 5 ; i <= Math . Sqrt ( n ) ; i += 6 ) { if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; } return true ; } } public static void Main ( String [ ] args ) { long num = 6 ; check ( num ) ; } }
Twin Pythagorean triplets in an array | C # program for the above approach ; Function to check if there exist a twin pythagorean triplet in the given array ; Loop to check if there is a Pythagorean triplet in the array ; Check if there is consecutive triple ; Calculate square of array elements ; Driver Code ; Given array [ ] arr ; Function call
using System ; class GFG { static bool isTriplet ( int [ ] ar , int n ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { for ( int k = j + 1 ; k < n ; k ++ ) { if ( Math . Abs ( ar [ i ] - ar [ j ] ) == 1 || Math . Abs ( ar [ j ] - ar [ k ] ) == 1 || Math . Abs ( ar [ i ] - ar [ k ] ) == 1 ) { int x = ar [ i ] * ar [ i ] , y = ar [ j ] * ar [ j ] , z = ar [ k ] * ar [ k ] ; if ( x == y + z y == x + z z == x + y ) return true ; } } } } return false ; } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 1 , 4 , 6 , 5 } ; int ar_size = arr . Length ; if ( isTriplet ( arr , ar_size ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }
Pair with min absolute difference and whose product is N + 1 or N + 2 | C # program for the above approach ; Function to print pair ( a , b ) such that a * b = N + 1 or N + 2 ; Loop to iterate over the desired possible values ; Check for condition 1 ; Check for condition 2 ; Driver Code ; Given Number ; Function Call
using System ; class GFG { static void closestDivisors ( int n ) { for ( int i = ( int ) Math . Sqrt ( n + 2 ) ; i > 0 ; i -- ) { if ( ( n + 1 ) % i == 0 ) { Console . Write ( i + " , ▁ " + ( n + 1 ) / i ) ; break ; } if ( ( n + 2 ) % i == 0 ) { Console . Write ( i + " , ▁ " + ( n + 2 ) / i ) ; break ; } } } public static void Main ( string [ ] args ) { int N = 123 ; closestDivisors ( N ) ; } }
Is it possible to reach N and M from 1 and 0 respectively as per given condition | C # program for the above approach ; Function that find given x and y is possible or not ; Check if x is less than 2 and y is not equal to 0 ; Perform subtraction ; Check if y is divisible by 2 and greater than equal to 0 ; Driver Code ; Given X and Y ; Function Call
using System ; class GFG { static bool is_possible ( int x , int y ) { if ( x < 2 && y != 0 ) return false ; y = y - x + 1 ; if ( y % 2 == 0 && y >= 0 ) return true ; else return false ; } public static void Main ( string [ ] args ) { int x = 5 , y = 2 ; if ( is_possible ( x , y ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }
Count of integers up to N which are non divisors and non coprime with N | C # program to implement the above approach ; Function to return the count of integers less than N satisfying given conditions ; Stores Euler counts ; Store Divisor counts ; Based on Sieve of Eratosthenes ; Update phi values of all multiples of i ; Update count of divisors ; Return the final count ; Driver Code
using System ; class GFG { public static int count ( int n ) { int [ ] phi = new int [ n + 1 ] ; int [ ] divs = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { phi [ i ] += i ; for ( int j = i * 2 ; j <= n ; j += i ) phi [ j ] -= phi [ i ] ; for ( int j = i ; j <= n ; j += i ) divs [ j ] ++ ; } return ( n - phi [ n ] - divs [ n ] + 1 ) ; } public static void Main ( String [ ] args ) { int N = 42 ; Console . WriteLine ( count ( N ) ) ; } }
Sum of all differences between Maximum and Minimum of increasing Subarrays | C # program to find the sum of differences of maximum and minimum of strictly increasing subarrays ; Function to calculate and return the sum of differences of maximum and minimum of strictly increasing subarrays ; Stores the sum ; Traverse the array ; If last element of the increasing sub - array is found ; Update sum ; If the last element of the array is reached ; Update sum ; Return the sum ; Driver Code
using System ; class GFG { static int sum_of_differences ( int [ ] arr , int N ) { int sum = 0 ; int i , j , flag ; for ( i = 0 ; i < N - 1 ; i ++ ) { if ( arr [ i ] < arr [ i + 1 ] ) { flag = 0 ; for ( j = i + 1 ; j < N - 1 ; j ++ ) { if ( arr [ j ] >= arr [ j + 1 ] ) { sum += ( arr [ j ] - arr [ i ] ) ; i = j ; flag = 1 ; break ; } } if ( flag == 0 && arr [ i ] < arr [ N - 1 ] ) { sum += ( arr [ N - 1 ] - arr [ i ] ) ; break ; } } } return sum ; } public static void Main ( string [ ] args ) { int [ ] arr = { 6 , 1 , 2 , 5 , 3 , 4 } ; int N = arr . Length ; Console . Write ( sum_of_differences ( arr , N ) ) ; } }
Construct a Maximum Binary Tree from two given Binary Trees | C # program to find the Maximum Binary Tree from two Binary Trees ; A binary tree node has data , pointer to left child and a pointer to right child ; Helper method that allocates a new node with the given data and NULL left and right pointers . ; Given a binary tree , print its nodes in inorder ; first recur on left child ; then print the data of node ; now recur on right child ; Method to find the maximum binary tree from two binary trees ; Driver Code ; First Binary Tree 3 / \ 2 6 / 20 ; Second Binary Tree 5 / \ 1 8 \ \ 2 8
using System ; class Node { public int data ; public Node left , right ; public Node ( int data , Node left , Node right ) { this . data = data ; this . left = left ; this . right = right ; } static Node newNode ( int data ) { return new Node ( data , null , null ) ; } static void inorder ( Node node ) { if ( node == null ) return ; inorder ( node . left ) ; Console . Write ( " { 0 } ▁ " , node . data ) ; inorder ( node . right ) ; } static Node MaximumBinaryTree ( Node t1 , Node t2 ) { if ( t1 == null ) return t2 ; if ( t2 == null ) return t1 ; t1 . data = Math . Max ( t1 . data , t2 . data ) ; t1 . left = MaximumBinaryTree ( t1 . left , t2 . left ) ; t1 . right = MaximumBinaryTree ( t1 . right , t2 . right ) ; return t1 ; } public static void Main ( String [ ] args ) { Node root1 = newNode ( 3 ) ; root1 . left = newNode ( 2 ) ; root1 . right = newNode ( 6 ) ; root1 . left . left = newNode ( 20 ) ; Node root2 = newNode ( 5 ) ; root2 . left = newNode ( 1 ) ; root2 . right = newNode ( 8 ) ; root2 . left . right = newNode ( 2 ) ; root2 . right . right = newNode ( 8 ) ; Node root3 = MaximumBinaryTree ( root1 , root2 ) ; inorder ( root3 ) ; } }
Minimum size binary string required such that probability of deleting two 1 's at random is 1/X | C # implementation of the above approach ; Function returns the minimum size of the String ; From formula ; Left limit of r ; Right limit of r ; Smallest integer in the valid range ; Driver Code
using System ; class GFG { static int MinimumString ( int x ) { int b = 1 ; double left_lim = Math . Sqrt ( x ) + 1.0 ; double right_lim = Math . Sqrt ( x ) + 2.0 ; int r = 0 ; for ( int i = ( int ) left_lim ; i <= right_lim ; i ++ ) { if ( i > left_lim && i < right_lim ) { r = i ; break ; } } return b + r ; } public static void Main ( String [ ] args ) { int X = 2 ; Console . Write ( MinimumString ( X ) ) ; } }
Minimum number of squares whose sum equals to a given number N | Set | C # program for the above approach ; Function that returns true if N is a perfect square ; Function that returns true check if N is sum of three squares ; Factor out the powers of 4 ; N is NOT of the form 4 ^ a * ( 8 b + 7 ) ; Function that finds the minimum number of square whose sum is N ; If N is perfect square ; If N is sum of 2 perfect squares ; If N is sum of 3 perfect squares ; Otherwise , N is the sum of 4 perfect squares ; Driver code ; Given number ; Function call
using System ; class GFG { static bool isPerfectSquare ( int N ) { int floorSqrt = ( int ) Math . Sqrt ( N ) ; return ( N == floorSqrt * floorSqrt ) ; } static bool legendreFunction ( int N ) { while ( N % 4 == 0 ) N /= 4 ; if ( N % 8 != 7 ) return true ; else return false ; } static int minSquares ( int N ) { if ( isPerfectSquare ( N ) ) return 1 ; for ( int i = 1 ; i * i < N ; i ++ ) { if ( isPerfectSquare ( N - i * i ) ) return 2 ; } if ( legendreFunction ( N ) ) return 3 ; return 4 ; } public static void Main ( String [ ] args ) { int N = 123 ; Console . Write ( minSquares ( N ) ) ; } }
Check if N leaves only distinct remainders on division by all values up to K | C # program to check if all remainders are distinct or not ; Function to check and return if all remainders are distinct ; Stores the remainder ; Calculate the remainder ; If remainder already occurred ; Insert into the set ; Driver Code
using System ; using System . Collections . Generic ; class GFG { static bool is_distinct ( long n , long k ) { HashSet < long > s = new HashSet < long > ( ) ; for ( int i = 1 ; i <= k ; i ++ ) { long tmp = n % i ; if ( s . Contains ( tmp ) ) { return false ; } s . Add ( tmp ) ; } return true ; } public static void Main ( String [ ] args ) { long N = 5 , K = 3 ; if ( is_distinct ( N , K ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }
Count of multiplicative partitions of N | C # implementation to find the multiplicative partitions of the given number N ; Function to return number of ways of factoring N with all factors greater than 1 ; Variable to store number of ways of factoring n with all factors greater than 1 ; Driver code ; 2 is the minimum factor of number other than 1. So calling recursive function to find number of ways of factoring N with all factors greater than 1
using System ; class GFG { static int getDivisors ( int min , int n ) { int total = 0 ; for ( int i = min ; i < n ; ++ i ) if ( n % i == 0 && n / i >= i ) { ++ total ; if ( n / i > i ) total += getDivisors ( i , n / i ) ; } return total ; } public static void Main ( ) { int n = 30 ; Console . Write ( 1 + getDivisors ( 2 , n ) ) ; } }
Find last 2 survivors in N persons standing in a circle after killing next to immediate neighbour | C # implementation of the approach ; Node for a Linked List ; Function to find the last 2 survivors ; Total is the count of alive people ; Initiating the list of n people ; Total != 2 is terminating condition because at last only two - person will remain alive ; Del represent next person to be deleted or killed ; Last two person to survive ( in any order ) ; Driver code
using System ; class GFG { class Node { public int val ; public Node next ; public Node ( int _val ) { val = _val ; next = null ; } } ; static void getLastTwoPerson ( int n ) { int total = n ; Node head = new Node ( 1 ) ; Node temp = head ; for ( int i = 2 ; i <= n ; i ++ ) { temp . next = new Node ( i ) ; temp = temp . next ; } temp . next = head ; temp = head ; Node del ; while ( total != 2 ) { del = temp . next . next ; temp . next . next = temp . next . next . next ; temp = temp . next ; del = null ; total -= 1 ; } Console . Write ( temp . val + " ▁ " + temp . next . val ) ; } public static void Main ( String [ ] args ) { int n = 2 ; getLastTwoPerson ( n ) ; } }
Philaland Coin | TCS Mockvita 2020 | C # implementation to find the minimum number of denominations required for any number ; Function to find the minimum number of denomminations required ; Driver Code ; Function Call
using System ; class GFG { static int findMinDenomin ( int n ) { return ( ( int ) ( Math . Log ( n ) / Math . Log ( 2 ) ) + 1 ) ; } static public void Main ( ) { int n = 10 ; Console . WriteLine ( findMinDenomin ( n ) ) ; } }
Content of a Polynomial | C # implementation to find the content of the polynomial ; Function to find the content of the polynomial ; Loop to iterate over the elements of the array ; __gcd ( a , b ) is a inbuilt function for Greatest Common Divisor ; Driver Code ; Function call
using System ; class GFG { static int findContent ( int [ ] arr , int n ) { int content = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { content = __gcd ( content , arr [ i ] ) ; } return content ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int n = 3 ; int [ ] arr = { 9 , 6 , 12 } ; Console . Write ( findContent ( arr , n ) ) ; } }
Check if the given array is same as its inverse permutation | C # program to implement the above approach ; Function to check if the inverse permutation of the given array is same as the original array ; Stores the inverse permutation ; Generate the inverse permutation ; Check if the inverse permutation is same as the given array ; Driver code
using System ; class GFG { static void inverseEqual ( int [ ] arr , int n ) { int [ ] brr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { int present_index = arr [ i ] - 1 ; brr [ present_index ] = i + 1 ; } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] != brr [ i ] ) { Console . WriteLine ( " No " ) ; return ; } } Console . WriteLine ( " Yes " ) ; } public static void Main ( String [ ] args ) { int n = 4 ; int [ ] arr = { 1 , 4 , 3 , 2 } ; inverseEqual ( arr , n ) ; } }
Linear Congruence method for generating Pseudo Random Numbers | C # implementation of the above approach ; Function to generate random numbers ; Initialize the seed state ; Traverse to generate required numbers of random numbers ; Follow the linear congruential method ; Driver code ; Seed value ; Modulus parameter ; Multiplier term ; Increment term ; Number of Random numbers to be generated ; To store random numbers ; Function call ; Print the generated random numbers
using System ; class GFG { static void linearCongruentialMethod ( int Xo , int m , int a , int c , int [ ] randomNums , int noOfRandomNums ) { randomNums [ 0 ] = Xo ; for ( int i = 1 ; i < noOfRandomNums ; i ++ ) { randomNums [ i ] = ( ( randomNums [ i - 1 ] * a ) + c ) % m ; } } public static void Main ( String [ ] args ) { int Xo = 5 ; int m = 7 ; int a = 3 ; int c = 3 ; int noOfRandomNums = 10 ; int [ ] randomNums = new int [ noOfRandomNums ] ; linearCongruentialMethod ( Xo , m , a , c , randomNums , noOfRandomNums ) ; for ( int i = 0 ; i < noOfRandomNums ; i ++ ) { Console . Write ( randomNums [ i ] + " ▁ " ) ; } } }
Multiplicative Congruence method for generating Pseudo Random Numbers | C # implementation of the above approach ; Function to generate random numbers ; Initialize the seed state ; Traverse to generate required numbers of random numbers ; Follow the multiplicative congruential method ; Driver code ; Seed value ; Modulus parameter ; Multiplier term ; Number of Random numbers to be generated ; To store random numbers ; Function call ; Print the generated random numbers
using System ; class GFG { static void multiplicativeCongruentialMethod ( int Xo , int m , int a , int [ ] randomNums , int noOfRandomNums ) { randomNums [ 0 ] = Xo ; for ( int i = 1 ; i < noOfRandomNums ; i ++ ) { randomNums [ i ] = ( randomNums [ i - 1 ] * a ) % m ; } } public static void Main ( String [ ] args ) { int Xo = 3 ; int m = 15 ; int a = 7 ; int noOfRandomNums = 10 ; int [ ] randomNums = new int [ noOfRandomNums ] ; multiplicativeCongruentialMethod ( Xo , m , a , randomNums , noOfRandomNums ) ; for ( int i = 0 ; i < noOfRandomNums ; i ++ ) { Console . Write ( randomNums [ i ] + " ▁ " ) ; } } }
Product of divisors of a number from a given list of its prime factors | C # program to implement the above approach ; Function to calculate ( a ^ b ) % m ; Function to calculate and return the product of divisors ; Stores the frequencies of prime divisors ; Iterate over the prime divisors ; Update the product ; Update the count of divisors ; Driver Code
using System ; using System . Collections . Generic ; class GFG { static int MOD = 1000000007 ; static int power ( int a , int b , int m ) { a %= m ; int res = 1 ; while ( b > 0 ) { if ( b % 2 == 1 ) res = ( ( res % m ) * ( a % m ) ) % m ; a = ( ( a % m ) * ( a % m ) ) % m ; b >>= 1 ; } return res % m ; } static int productOfDivisors ( int [ ] p , int n ) { Dictionary < int , int > prime = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( prime . ContainsKey ( p [ i ] ) ) prime [ p [ i ] ] = prime [ p [ i ] ] + 1 ; else prime . Add ( p [ i ] , 1 ) ; } int product = 1 , d = 1 ; foreach ( KeyValuePair < int , int > itr in prime ) { int val = power ( itr . Key , ( itr . Value ) * ( itr . Value + 1 ) / 2 , MOD ) ; product = ( power ( product , itr . Value + 1 , MOD ) * power ( val , d , MOD ) ) % MOD ; d = ( d * ( itr . Value + 1 ) ) % ( MOD - 1 ) ; } return product ; } public static void Main ( String [ ] args ) { int [ ] arr = { 11 , 11 } ; int n = arr . Length ; Console . WriteLine ( productOfDivisors ( arr , n ) ) ; } }
Print all proper fractions with denominators less than equal to N | C # program to implement the above approach ; Function to print all proper fractions ; If the numerator and the denominator are coprime ; Driver code
using System ; class GFG { static void printFractions ( int n ) { for ( int i = 1 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { if ( __gcd ( i , j ) == 1 ) { string a = i . ToString ( ) ; string b = j . ToString ( ) ; Console . Write ( a + " / " + b + " , ▁ " ) ; } } } } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void Main ( string [ ] args ) { int n = 3 ; printFractions ( n ) ; } }
Maximum number of objects that can be created as per given conditions | C # program for the above problem ; Function for finding the maximum number of objects from N type - 1 and M type - 2 items ; Storing minimum of N and M ; Storing maximum number of objects from given items ; Driver Code
using System ; class GFG { static int numberOfObjects ( int N , int M ) { int initial = Math . Min ( N , M ) ; int last = ( N + M ) / 3 ; return Math . Min ( initial , last ) ; } public static void Main ( string [ ] args ) { int N = 8 ; int M = 7 ; Console . Write ( numberOfObjects ( N , M ) ) ; } }
Square root of a number by Repeated Subtraction method | C # implementation of the above approach ; Function to return the square root of the given number ; Subtract n - th odd number ; Return the result ; Driver code
using System ; class GFG { public static int SquareRoot ( int num ) { int count = 0 ; for ( int n = 1 ; n <= num ; n += 2 ) { num = num - n ; count += 1 ; if ( num == 0 ) break ; } return count ; } public static void Main ( ) { int N = 81 ; Console . Write ( SquareRoot ( N ) ) ; } }
Maximize count of distinct elements possible in an Array from the given operation | C # program to find the maximum possible distinct elements that can be obtained from the array by performing the given operations ; Function to find the gcd of two numbers ; Function to calculate and return the count of maximum possible distinct elements in the array ; Find the maximum element ; Base Case ; Finding the gcd of first two element ; Calculate Gcd of the array ; Return the total count of distinct elements ; Driver Code
using System ; using System . Linq ; class GFG { static int gcd ( int x , int y ) { if ( x == 0 ) return y ; return gcd ( y % x , x ) ; } static int findDistinct ( int [ ] arr , int n ) { int maximum = arr . Max ( ) ; if ( n == 1 ) return 1 ; if ( n == 2 ) { return ( maximum / gcd ( arr [ 0 ] , arr [ 1 ] ) ) ; } int k = gcd ( arr [ 0 ] , arr [ 1 ] ) ; for ( int i = 2 ; i < n ; i ++ ) { k = gcd ( k , arr [ i ] ) ; } return ( maximum / k ) ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 5 } ; int n = arr . Length ; Console . Write ( findDistinct ( arr , n ) ) ; } }
Find indices of all local maxima and local minima in an Array | C # program for the above approach ; Function to find all the local maxima and minima in the given array arr [ ] ; Empty vector to store points of local maxima and minima ; Checking whether the first point is local maxima or minima or none ; Iterating over all points to check local maxima and local minima ; Condition for local minima ; Condition for local maxima ; Checking whether the last point is local maxima or minima or none ; Print all the local maxima and local minima indexes stored ; Driver code ; Given array arr [ ] ; Function call
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { public static void findLocalMaximaMinima ( int n , int [ ] arr ) { ArrayList mx = new ArrayList ( ) ; ArrayList mn = new ArrayList ( ) ; if ( arr [ 0 ] > arr [ 1 ] ) mx . Add ( 0 ) ; else if ( arr [ 0 ] < arr [ 1 ] ) mn . Add ( 0 ) ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( ( arr [ i - 1 ] > arr [ i ] ) && ( arr [ i ] < arr [ i + 1 ] ) ) mn . Add ( i ) ; else if ( ( arr [ i - 1 ] < arr [ i ] ) && ( arr [ i ] > arr [ i + 1 ] ) ) mx . Add ( i ) ; } if ( arr [ n - 1 ] > arr [ n - 2 ] ) mx . Add ( n - 1 ) ; else if ( arr [ n - 1 ] < arr [ n - 2 ] ) mn . Add ( n - 1 ) ; if ( mx . Count > 0 ) { Console . Write ( " Points ▁ of ▁ Local ▁ " + " maxima ▁ are ▁ : ▁ " ) ; foreach ( int a in mx ) Console . Write ( a + " ▁ " ) ; Console . Write ( " STRNEWLINE " ) ; } else Console . Write ( " There ▁ are ▁ no ▁ points ▁ " + " of ▁ Local ▁ Maxima ▁ " ) ; if ( mn . Count > 0 ) { Console . Write ( " Points ▁ of ▁ Local ▁ " + " minima ▁ are ▁ : ▁ " ) ; foreach ( int a in mn ) Console . Write ( a + " ▁ " ) ; Console . Write ( " STRNEWLINE " ) ; } else Console . Write ( " There ▁ are ▁ no ▁ points ▁ of ▁ " + " Local ▁ Maxima ▁ " ) ; } public static void Main ( string [ ] args ) { int N = 9 ; int [ ] arr = { 10 , 20 , 15 , 14 , 13 , 25 , 5 , 4 , 3 } ; findLocalMaximaMinima ( N , arr ) ; } }