Posts

Showing posts with the label logic and algorithm

Build Your Algo | Practice Coding | Programming Language |

Image
  BUILD YOUR ALGORITHM  CODE !           ( Any programming language ,  Build in any logic  , Practice Coding)

Counter() | Collection library | Python Langauage

                Learn and Practice :  

PRACTICE | Word Order | Python program | BUILD YOUR LOGIC AND ALGORITHUM

Image
"Word Order"     You are given words. Some words may repeat. For each word, output its number of occurrences. The output order should correspond with the input order of appearance of the word. See the sample input/output for clarification. Note: Each input line ends with a "\n" character. Constraints: The sum of the lengths of all the words do not exceed All the words are composed of lowercase English letters only. Input Format : The first line contains the integer, . The next lines each contain a word. Output Format : Output lines. On the first line, output the number of distinct words from the input. On the second line, output the number of occurrences for each distinct word according to their appearance in the input. Sample Input : 4 bcdef abcdefg bcde bcdef Sample Output Sample Output: 3 2 1 1 Explanation: There are distinct words. Here, "bcdef" appears twice in the input at the first and last positions...

Bulid your logic and algorithm | C Program

Image
Build a program in c Language : Logic: 1.Take an array 2.Insert elements of 4 elements. 3.Select one element and sum the rest 4.Check weather it is larger than sum or not. Output:   Code: #include<stdio.h> #define max 4 int a[max]; void input(); void greater(); int sum,i,j; void main() { input(); greater(); } void input() { printf("Enter the four element: \n"); for(i=0;i<max;i++) scanf("%d",&a[i]); } void greater() { for(i=0;i<max;i++) { sum=0; for(j=0;j<max;j++) { if(a[j]!=a[i]) { sum=sum+a[j]; } } if(sum<a[i]) { printf("\n %d is greater than sum of rest= %d\n",a[i],sum); } } }