Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- class TwoTurtledoves
- {
- public int presentType(int n)
- {
- List<int> presents = new List<int>();
- int currentType = 1;
- while (presents.Count < n)
- {
- for (int i = 0; i < currentType; i++)
- {
- int thisType = currentType;
- while (thisType > 0)
- {
- presents.Add(thisType);
- thisType--;
- }
- }
- currentType++;
- }
- return presents[n];
- }
- }
Add Comment
Please, Sign In to add comment