Advertisement
sak1b

https://leetcode.com/problems/count-sorted-vowel-strings/submissions/

Dec 4th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. class Solution {
  2. public:
  3. int countVowelStrings(int n) {
  4.  
  5. if(n==1) return 5;
  6.  
  7. int sum = 0;
  8. int a[5] = {1,1,1,1,1};
  9.  
  10.  
  11. for(int i=1;i<n;i++){
  12.  
  13. a[0] = a[0]+a[1]+a[2]+a[3]+a[4];
  14. a[1] = a[1]+a[2]+a[3]+a[4];
  15. a[2] = a[2]+a[3]+a[4];
  16. a[3] = a[3]+a[4];
  17. a[4] = a[4];
  18.  
  19. sum = a[0]+a[1]+a[2]+a[3]+a[4];
  20. }
  21.  
  22. return sum;
  23. }
  24. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement