daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Dec 16th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  function  FindElem( mat, elem,  M,  N)
  2.         {
  3.             var row = 0;
  4.             var col = N - 1;
  5.             var cont = 0;
  6.             while (row < M && col >= 0)
  7.             {
  8.                 if (mat[row][col] == elem)
  9.                 {
  10.                     cont++;
  11.                     //return true;
  12.                 }
  13.                 if (mat[row][col] > elem)
  14.                 {
  15.                     col--;
  16.                 }
  17.                 else
  18.                 {
  19.                     row++;
  20.                 }
  21.             }
  22.             return cont;
  23.         }
  24.  
  25. function countNumber(arr,num){
  26.   //coding and coding..
  27.   return FindElem( arr, num, arr.length, arr[0].length);
  28.  
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top