Page 4 of 6 FirstFirst ... 23456 LastLast
Results 76 to 100 of 142
Like Tree22Likes

Thread: The Code Marathon.

  1. #76
    not actually a porcupine porcupinetree's Avatar
    Join Date
    Dec 2014
    HSC
    2015
    Gender
    Male
    Posts
    666
    Rep Power
    3

    Re: The Code Marathon.

    Write a method/program which:

    • Tests whether an input word/string is a palindrome
    • If not, then determines whether or not there is a possible arrangement of the word/string such that it is a palindrome, and then gives one of these arrangements
    Bachelor of Science (Advanced Mathematics) @ USYD

  2. #77
    Loquacious One turntaker's Avatar
    Join Date
    May 2013
    HSC
    2015
    Gender
    Undisclosed
    Posts
    3,956
    Rep Power
    6

    Re: The Code Marathon.

    Quote Originally Posted by porcupinetree View Post
    Write a method/program which:

    • Tests whether an input word/string is a palindrome
    • If not, then determines whether or not there is a possible arrangement of the word/string such that it is a palindrome, and then gives one of these arrangements
    ill do this after my last exam, but my guess is convert string to an array of char and iterate backwards to check for the word again.

    Not sure how you would go about the second part. ill think about it later
    "I have crippling depression" -Mahatma Gandhi
    Quote Originally Posted by Katsumi View Post
    lol

  3. #78
    Webmaster brent012's Avatar
    Join Date
    Feb 2008
    HSC
    2011
    Gender
    Male
    Posts
    4,684
    Rep Power
    20

    Re: The Code Marathon.

    Quote Originally Posted by turntaker View Post
    my guess is convert string to an array of char and iterate backwards to check for the word again.
    Alternatively, in Java, StringBuilder/StringBuffer have a reverse() method.
    ~

  4. #79
    Loquacious One turntaker's Avatar
    Join Date
    May 2013
    HSC
    2015
    Gender
    Undisclosed
    Posts
    3,956
    Rep Power
    6

    Re: The Code Marathon.

    Quote Originally Posted by brent012 View Post
    Alternatively, in Java, StringBuilder/StringBuffer have a reverse() method.
    ah yeah lol.
    I am new to java and very unfamiliar with built in methods
    "I have crippling depression" -Mahatma Gandhi
    Quote Originally Posted by Katsumi View Post
    lol

  5. #80
    Webmaster brent012's Avatar
    Join Date
    Feb 2008
    HSC
    2011
    Gender
    Male
    Posts
    4,684
    Rep Power
    20

    Re: The Code Marathon.

    Quote Originally Posted by turntaker View Post
    ah yeah lol.
    I am new to java and very unfamiliar with built in methods
    StringBuilder and StringBuffer (same interface iirc) have a lot of built in string operations. BigInteger also has isProbablePrime and gcd which are sometimes useful for these style of questions.
    ~

  6. #81
    -insert title here- Paradoxica's Avatar
    Join Date
    Jun 2014
    HSC
    2016
    Gender
    Male
    Location
    Outside reality
    Posts
    2,440
    Rep Power
    5

    Re: The Code Marathon.

    Quote Originally Posted by brent012 View Post
    StringBuilder and StringBuffer (same interface iirc) have a lot of built in string operations. BigInteger also has isProbablePrime and gcd which are sometimes useful for these style of questions.
    Unfortunately for many coding problems probable prime doesn't cut it.
    If I am a conic section, then my e = ∞

    Just so we don't have this discussion in the future, my definition of the natural numbers includes 0.

  7. #82
    Executive Member KingOfActing's Avatar
    Join Date
    Oct 2015
    HSC
    2016
    Gender
    Male
    Location
    Sydney
    Posts
    996
    Rep Power
    3

    Re: The Code Marathon.

    Quote Originally Posted by porcupinetree View Post
    Write a method/program which:

    • Tests whether an input word/string is a palindrome
    • If not, then determines whether or not there is a possible arrangement of the word/string such that it is a palindrome, and then gives one of these arrangements
    I don't like generating permutations and checking, that's . Easier to check if a permutation exists, and make one yourself

    (P.S. it's Java, not PHP, but PHP code tags have better Syntax highlighting)
    PHP Code:
    public static void palindrome(String in)
    {
        if(new 
    StringBuilder(in).reverse().toString().equals(in))
        {
            
    System.out.println(in " is a palindrome!");
        }
        else
        {
            
    Map<CharacterIntegerbuckets = new HashMap<>();
            
            for(
    Character c in.toCharArray())
            {
                if(
    buckets.containsKey(c))
                {
                    
    buckets.put(cbuckets.get(c) + 1);
                }
                else
                {
                    
    buckets.put(c1);
                }
            }
            
    Character[] permutation = new Character[in.length()];
            
    int i 0;
            for(
    Entry<CharacterIntegerbuckets.entrySet())
            {
                if(
    in.length() % == 0)
                {
                    if(
    e.getValue() % == 1)
                    {
                        
    System.out.println("None of the permutations of " in " are palindromic.");
                        return;
                    }
                    else
                    {
                        for(
    int j 0e.getValue(); j+=2)
                        {
                            
    permutation[i] = e.getKey();
                            
    permutation[in.length() - 1] = e.getKey();
                            
    i++;
                        }
                    }        
                }
                else
                {
                    if(
    e.getValue() % == 1)
                    {    
                        if(
    permutation[(in.length() - 1)/2] == null)
                        {
                            
    permutation[(in.length() - 1)/2] = e.getKey();
                            for(
    int j 0e.getValue() - 1j+=2)
                            {
                                
    permutation[i] = e.getKey();
                                
    permutation[in.length() - 1] = e.getKey();
                                
    i++;
                            }
                        }
                        else
                        {
                            
    System.out.println("None of the permutations of " in " are palindromic.");
                            return;
                        }
                    }
                    else
                    {
                        for(
    int j 0e.getValue(); j+=2)
                        {
                            
    permutation[i] = e.getKey();
                            
    permutation[in.length() - 1] = e.getKey();
                            
    i++;
                        }
                    }
                }
            }
            
    String perm "";
            for(
    Character c permutation)
            {
                
    perm+=c;
            }
            
    System.out.println(in " is not a plaindrome but " perm " is.");
        }

    2015 HSC
    Mathematics 2U
    2016 HSC
    Advanced English, Drama, Maths 3U, Maths 4U, Music 2, Extension Music, Chemistry, Software Design & Development
    Currently studying
    Advanced Mathematics (Hons)/Computer Science @ UNSW (2017– )

  8. #83
    -insert title here- Paradoxica's Avatar
    Join Date
    Jun 2014
    HSC
    2016
    Gender
    Male
    Location
    Outside reality
    Posts
    2,440
    Rep Power
    5

    Re: The Code Marathon.

    Quote Originally Posted by KingOfActing View Post
    I don't like generating permutations and checking, that's . Easier to check if a permutation exists, and make one yourself

    (P.S. it's Java, not PHP, but PHP code tags have better Syntax highlighting)
    PHP Code:
    public static void palindrome(String in)
    {
        if(new 
    StringBuilder(in).reverse().toString().equals(in))
        {
            
    System.out.println(in " is a palindrome!");
        }
        else
        {
            
    Map<CharacterIntegerbuckets = new HashMap<>();
            
            for(
    Character c in.toCharArray())
            {
                if(
    buckets.containsKey(c))
                {
                    
    buckets.put(cbuckets.get(c) + 1);
                }
                else
                {
                    
    buckets.put(c1);
                }
            }
            
    Character[] permutation = new Character[in.length()];
            
    int i 0;
            for(
    Entry<CharacterIntegerbuckets.entrySet())
            {
                if(
    in.length() % == 0)
                {
                    if(
    e.getValue() % == 1)
                    {
                        
    System.out.println("None of the permutations of " in " are palindromic.");
                        return;
                    }
                    else
                    {
                        for(
    int j 0e.getValue(); j+=2)
                        {
                            
    permutation[i] = e.getKey();
                            
    permutation[in.length() - 1] = e.getKey();
                            
    i++;
                        }
                    }        
                }
                else
                {
                    if(
    e.getValue() % == 1)
                    {    
                        if(
    permutation[(in.length() - 1)/2] == null)
                        {
                            
    permutation[(in.length() - 1)/2] = e.getKey();
                            for(
    int j 0e.getValue() - 1j+=2)
                            {
                                
    permutation[i] = e.getKey();
                                
    permutation[in.length() - 1] = e.getKey();
                                
    i++;
                            }
                        }
                        else
                        {
                            
    System.out.println("None of the permutations of " in " are palindromic.");
                            return;
                        }
                    }
                    else
                    {
                        for(
    int j 0e.getValue(); j+=2)
                        {
                            
    permutation[i] = e.getKey();
                            
    permutation[in.length() - 1] = e.getKey();
                            
    i++;
                        }
                    }
                }
            }
            
    String perm "";
            for(
    Character c permutation)
            {
                
    perm+=c;
            }
            
    System.out.println(in " is not a plaindrome but " perm " is.");
        }

    Wouldn't it be easier to just run a character count that passes if and only if exactly 0 or 1 of the characters have an odd amount?

    Because that's the only way a random string of characters can have a palindrome.

    Also what's the runtime complexity of your algorithm

    Also if you're gonna procrastinate with coding please procrastinate with 4U which is more relevant for you tomorrow.
    If I am a conic section, then my e = ∞

    Just so we don't have this discussion in the future, my definition of the natural numbers includes 0.

  9. #84
    Executive Member KingOfActing's Avatar
    Join Date
    Oct 2015
    HSC
    2016
    Gender
    Male
    Location
    Sydney
    Posts
    996
    Rep Power
    3

    Re: The Code Marathon.

    Quote Originally Posted by Paradoxica View Post
    Wouldn't it be easier to just run a character count that passes if and only if exactly 0 or 1 of the characters have an odd amount?

    Because that's the only way a random string of characters can have a palindrome.

    Also what's the runtime complexity of your algorithm

    Also if you're gonna procrastinate with coding please procrastinate with 4U which is more relevant for you tomorrow.
    The reason I don't just check because I need to return a palindrome if a permutation is possible, so I need to store all counts of all characters. Complexity is at the very worst.
    2015 HSC
    Mathematics 2U
    2016 HSC
    Advanced English, Drama, Maths 3U, Maths 4U, Music 2, Extension Music, Chemistry, Software Design & Development
    Currently studying
    Advanced Mathematics (Hons)/Computer Science @ UNSW (2017– )

  10. #85
    -insert title here- Paradoxica's Avatar
    Join Date
    Jun 2014
    HSC
    2016
    Gender
    Male
    Location
    Outside reality
    Posts
    2,440
    Rep Power
    5

    Re: The Code Marathon.

    Quote Originally Posted by KingOfActing View Post
    The reason I don't just check because I need to return a palindrome if a permutation is possible, so I need to store all counts of all characters. Complexity is at the very worst.
    So what's the complexity you gave? nlogn? n?
    If I am a conic section, then my e = ∞

    Just so we don't have this discussion in the future, my definition of the natural numbers includes 0.

  11. #86
    Executive Member KingOfActing's Avatar
    Join Date
    Oct 2015
    HSC
    2016
    Gender
    Male
    Location
    Sydney
    Posts
    996
    Rep Power
    3

    Re: The Code Marathon.

    Quote Originally Posted by Paradoxica View Post
    So what's the complexity you gave? nlogn? n?
    n^2 worst case
    2015 HSC
    Mathematics 2U
    2016 HSC
    Advanced English, Drama, Maths 3U, Maths 4U, Music 2, Extension Music, Chemistry, Software Design & Development
    Currently studying
    Advanced Mathematics (Hons)/Computer Science @ UNSW (2017– )

  12. #87
    -insert title here- Paradoxica's Avatar
    Join Date
    Jun 2014
    HSC
    2016
    Gender
    Male
    Location
    Outside reality
    Posts
    2,440
    Rep Power
    5

    Re: The Code Marathon.

    Quote Originally Posted by KingOfActing View Post
    n^2 worst case
    For your algorithm, or for my procedure? YOU'RE NOT BEING SPECIFIC ENOUGH
    If I am a conic section, then my e = ∞

    Just so we don't have this discussion in the future, my definition of the natural numbers includes 0.

  13. #88
    Executive Member KingOfActing's Avatar
    Join Date
    Oct 2015
    HSC
    2016
    Gender
    Male
    Location
    Sydney
    Posts
    996
    Rep Power
    3

    Re: The Code Marathon.

    Quote Originally Posted by Paradoxica View Post
    For your algorithm, or for my procedure? YOU'RE NOT BEING SPECIFIC ENOUGH
    For mine. Yours has more time complexity at the very worst. Your check can be made O(n^2) (a nested for loop to get the character count), and then more time to generate a palindrome in case it's possible. Mine runs in O(n) for checking for palindrome (increment count for each character by looping array once, then afterwards loop the entries), but the generation of the palindrome is O(n^2) worst case (average case O(nlogn) now that I think about it - for each character, loop the amount of times that character was present, the only time it'll be n^2 is if it's a string like "aaaaaaaaaaaaaaaa").
    2015 HSC
    Mathematics 2U
    2016 HSC
    Advanced English, Drama, Maths 3U, Maths 4U, Music 2, Extension Music, Chemistry, Software Design & Development
    Currently studying
    Advanced Mathematics (Hons)/Computer Science @ UNSW (2017– )

  14. #89
    New Member
    Join Date
    Feb 2014
    HSC
    2016
    Gender
    Male
    Posts
    3
    Rep Power
    4

    Re: The Code Marathon.

    PYTHON 3

    Case does not matter in this answer

    Code:
    import itertools
    import sys
    
    word = list(input("Input word: ").lower())
    
    if "".join(word) == "".join(word[::-1]):
    	print("".join(word),"is a palindrome.")
    	sys.exit()
    else:
    	arrange = itertools.permutations(word, len(word))
    	for x in arrange:
    		if "".join(x) == "".join(x[::-1]):
    			print("The word","".join(word),"can be turned into a palindrome when in this order:","".join(x))
    			sys.exit()
    			
    print("No palindrome.")
    Last edited by edwin8867; 19 Jun 2016 at 9:43 PM.

  15. #90
    Cole World Nailgun's Avatar
    Join Date
    Jun 2014
    HSC
    2016
    Gender
    Male
    Posts
    2,210
    Rep Power
    5

    Re: The Code Marathon.

    Quote Originally Posted by Paradoxica View Post
    Wouldn't it be easier to just run a character count that passes if and only if exactly 0 or 1 of the characters have an odd amount?

    Because that's the only way a random string of characters can have a palindrome.

    Also what's the runtime complexity of your algorithm

    Also if you're gonna procrastinate with coding please procrastinate with 4U which is more relevant for you tomorrow.
    +1
    Veni, Vidi, Vici

  16. #91
    Executive Member KingOfActing's Avatar
    Join Date
    Oct 2015
    HSC
    2016
    Gender
    Male
    Location
    Sydney
    Posts
    996
    Rep Power
    3

    Re: The Code Marathon.

    Quote Originally Posted by edwin8867 View Post
    PYTHON 3

    Case does not matter in this answer

    Code:
    import itertools
    import sys
    
    word = list(input("Input word: ").lower())
    
    if "".join(word) == "".join(word[::-1]):
    	print("".join(word),"is a palindrome.")
    	sys.exit()
    else:
    	arrange = itertools.permutations(word, len(word))
    	for x in arrange:
    		if "".join(x) == "".join(x[::-1]):
    			print("The word","".join(word),"can be turned into a palindrome when in this order:","".join(x))
    			sys.exit()
    			
    print("No palindrome.")
    This is the O(n!) solution I was talking about. Test abcdefghijklmnoppomnlkjihgfedcab for example, it takes foreeeever to check (actually, it's still running on my computer). My solution took 0.1ms for that test case It's incredibly ineffecient to check every permutation.

    Quote Originally Posted by Nailgun View Post
    +1
    I can multitask pshhhh
    2015 HSC
    Mathematics 2U
    2016 HSC
    Advanced English, Drama, Maths 3U, Maths 4U, Music 2, Extension Music, Chemistry, Software Design & Development
    Currently studying
    Advanced Mathematics (Hons)/Computer Science @ UNSW (2017– )

  17. #92
    New Member
    Join Date
    Feb 2014
    HSC
    2016
    Gender
    Male
    Posts
    3
    Rep Power
    4

    Re: The Code Marathon.

    Quote Originally Posted by Paradoxica View Post
    Wouldn't it be easier to just run a character count that passes if and only if exactly 0 or 1 of the characters have an odd amount?

    Because that's the only way a random string of characters can have a palindrome.

    Also what's the runtime complexity of your algorithm

    Also if you're gonna procrastinate with coding please procrastinate with 4U which is more relevant for you tomorrow.
    PYTHON 3

    Code:
    word = list(input("Input word: ").lower())
    letters = {}
    character = ""
    phrase = ""
    
    if "".join(word) == "".join(word[::-1]):
    	print("".join(word),"is a palindrome.")
    else:
    	odd = 0
    	for x in word:
    		if x not in letters:
    			letters[x] = 1
    		else:
    			letters[x] += 1
    	for x in letters:
    		if letters.get(x)%2 > 0:
    			character = x*letters.get(x)
    			odd += 1
    		else:
    			phrase = phrase+(x*int((letters.get(x)/2)))
    	phrase=phrase+character+phrase[::-1]
    	if odd > 1:
    		print("No palindrome.")
    	else:
    		print("The word "+"".join(word)+" can be turned into a palindrome when in this order: "+phrase+".")
    Last edited by edwin8867; 19 Jun 2016 at 10:24 PM.

  18. #93
    Loquacious One Drsoccerball's Avatar
    Join Date
    May 2014
    HSC
    2015
    Gender
    Undisclosed
    Posts
    3,664
    Rep Power
    6

    Re: The Code Marathon.

    Don't judge me I solved what porcupine asked for.

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <ctype.h>
    #define MAX_WORD_LENGTH 100
    
    int main(void){
    	char word[MAX_WORD_LENGTH];
    
    	fgets(word, MAX_WORD_LENGTH, stdin);
    	int i;
    
    	for(i = 0; word[i] != '\n'; i++){
    	}
    	// count how many characters in the word/string.
    
    	int j = 0;
    	// if the last letter and first are not the same then it isnt a palindrome.
    
    	while(word[j] != '\n'){
    		if(word[j] != ' ' && word[i - 1] == ' '){
    			j = j - 1;
    			i = i - 1;
    		}
    		if((word[j] != ' ' && word[i - 1] == ' ')){
    			j++;
    		}
    		char c;
    		c = word[j];
    		// Checks upper/lower case letters.
    		if((word[j] == word[i - 1]) || (toupper(c) == word[i-1]) || ((tolower(c) == word[i-1]))){
    			i = i - 1;
    		}
    		j++;
    	}
    
    	if(i != 0){
    		printf("This is not a palindrome.\n");
    	}
    	else{
    		printf("String is a palindrome.\n");
    		return 1;
    	}
    
    	for(int x = 0; word[x + 1] != '\n';x++){
    		for(int y = 0; word[y] != '\n';y++){
    			if(word[x] == word[y] && x != y && x + 1 != y ){
    				printf("There exists a palindrome and an example of this is: ");
    				printf("%c%c%c\n", word[x], word[x + 1],word[y]);
    				return 1;
    			}
    			if(word[x] == word[y] && x != y && x + 1 == y ){
    				printf("There exists a palindrome and an example of this is: ");
    				printf("%c%c%c\n", word[x], word[0],word[y]);
    				return 1;
    			}
    		}
    	}
    	return 0;
    }

  19. #94
    Loquacious One turntaker's Avatar
    Join Date
    May 2013
    HSC
    2015
    Gender
    Undisclosed
    Posts
    3,956
    Rep Power
    6

    Re: The Code Marathon.

    C is weird.
    "I have crippling depression" -Mahatma Gandhi
    Quote Originally Posted by Katsumi View Post
    lol

  20. #95
    Executive Member KingOfActing's Avatar
    Join Date
    Oct 2015
    HSC
    2016
    Gender
    Male
    Location
    Sydney
    Posts
    996
    Rep Power
    3

    Re: The Code Marathon.

    Given a list of double (or float if your language doesn't support doubles) tuples [x1,y1],[x2,y2],...,[xn,yn] and a value t, return the value of f(t) such that f(x) is the interpolating polynomial of the points. You may assume no two x values given are the same.
    2015 HSC
    Mathematics 2U
    2016 HSC
    Advanced English, Drama, Maths 3U, Maths 4U, Music 2, Extension Music, Chemistry, Software Design & Development
    Currently studying
    Advanced Mathematics (Hons)/Computer Science @ UNSW (2017– )

  21. #96
    Loquacious One Drsoccerball's Avatar
    Join Date
    May 2014
    HSC
    2015
    Gender
    Undisclosed
    Posts
    3,664
    Rep Power
    6

    Re: The Code Marathon.

    Quote Originally Posted by turntaker View Post
    C is weird.
    wanna get knocked

  22. #97
    not actually a porcupine porcupinetree's Avatar
    Join Date
    Dec 2014
    HSC
    2015
    Gender
    Male
    Posts
    666
    Rep Power
    3

    Re: The Code Marathon.

    Write a method/program which displays Pascal's triangle up to n rows, n a given positive integer.
    Bachelor of Science (Advanced Mathematics) @ USYD

  23. #98
    Supreme Member Flop21's Avatar
    Join Date
    May 2013
    HSC
    2015
    Gender
    Female
    Posts
    2,850
    Rep Power
    5

    Re: The Code Marathon.

    Quote Originally Posted by porcupinetree View Post
    Write a method/program which displays Pascal's triangle up to n rows, n a given positive integer.
    Umm the pascal part seems a bit complicated at this point, so I just made a program that creates the triangle... lol


    Code:
    #include <stdio.h>
    
    #include <stdlib.h>
    
    #include <assert.h>
    
    
    
    void printFPattern (int size);
    
    
    
    int main (int argc, char *argv[]) {
    
       assert (argc > 1);
    
       int size = atoi (argv[1]);
    
       printPattern (size);
    
       return EXIT_SUCCESS;
    
    }
    
    void printPattern (int size) {
    
       int row = 0;
    
       int col = 0;
    
       int numberSize = 0;
       int numberCount = 0;
       int spaceSize = 0;
       int spaceCount = 0;
    
       numberSize = 1;
       spaceSize = size;
    
    
       while (row < size+1) {
    
             while (spaceCount < spaceSize && col < size+1) {
                printf(" ");
                spaceCount++;
                col++;
             }
             while (numberCount < numberSize && col < size+1) {
                printf("1 ");
                numberCount++;
                col++;
             }
             spaceCount = 0;
             while (spaceCount < spaceSize && col < size+1) {
                printf(" ");
                spaceCount++;
                col++;
             }      
    
          printf("\n");
    
          row++;
          col = 0;
          spaceCount = 0;
          numberCount = 0;
          spaceSize--;
          numberSize++;
    
       }
    
    }
    2015 HSC: English Adv, Mathematics, Business Studies, Biology, Multimedia.

    HSC Biology Flashcards

  24. #99
    New Member
    Join Date
    Feb 2014
    HSC
    2016
    Gender
    Male
    Posts
    3
    Rep Power
    4

    Re: The Code Marathon.

    Quote Originally Posted by porcupinetree View Post
    Write a method/program which displays Pascal's triangle up to n rows, n a given positive integer.
    PYTHON 3

    Does not output as a nice looking triangle though.

    Code:
    number = int(input("Enter n rows: "))
    triangle = [[1],[1,1]]
    if number == 1:
    	del triangle[-1]
    number = number - 2
    current = 1
    for x in range(1, number+1):
    	row = [1]
    	for y in range(current):
    		row.append(triangle[x][y]+triangle[x][y+1])
    	row.append(1)
    	triangle.append(row)
    	current += 1
    for x in triangle:
    	print(" ".join(map(str, x)))
    Last edited by edwin8867; 20 Jun 2016 at 7:14 PM.

  25. #100
    Junior Member parad0xica's Avatar
    Join Date
    Mar 2016
    HSC
    N/A
    Gender
    Male
    Posts
    204
    Rep Power
    2

    Re: The Code Marathon.

    Quote Originally Posted by porcupinetree View Post
    Write a method/program which displays Pascal's triangle up to n rows, n a given positive integer.
    C code. Printing is not perfect when (two or more)-digit numbers exists.

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    //recursive factorial function
    int factorial (int num){
      if (num == 0 || num == 1) {
        return 1;
      }
      return num*factorial(num-1);
    }
    
    void printSpace (int num){
      while (--num >= 0) {
        printf(" ");
      }
    }
    
    int main (int argc, char *argv[]){
      int n = atoi(argv[1]);
      int i = 0;
      int j = 0;
      int depth = n;
      while (i <= n) {
        printSpace(depth--);
        for (j = 0; j < i + 1; j++) {
          //compute C(i, j)
          printf("%d ", factorial(i)/(factorial(j)*factorial(i-j)));
        }
        printf("\n");
        i++;
      }
      return 0;
    }
    Last edited by parad0xica; 20 Jun 2016 at 8:50 PM.
    Clue 1: 121 112
    Who am I?

    ( ͡° ͜ʖ ͡°) ( ͡° ͜ʖ ͡°)Clue 2

    Clue 0: Clockwise

    Clue 3: Are you watching closely? ∃ a clue every now and then
    Clue 4: 99 115
    Clue 5: |℘(S)| = 15^2 + 31

Page 4 of 6 FirstFirst ... 23456 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •