<commit_before>package vtn

func triangleNumbers(nums []int) int {
    return 0
}<commit_msg>brute force<commit_after>package vtn

import "sort"

func triangleNumbers(nums []int) int {
    return bruteForce(nums)
}

func bruteForce(nums []int) int {
    var res int
    n := len(nums)
    if n < 3 {
        return res
    }
    // sort nums O(nlgn)
    sort.Slice(nums, func(i, j int) bool {
        return nums[i] <= nums[j]
    })
    // time complexity O(n^3)
    for i := 0; i < n-2; i++ {
        for j := i + 1; j < n-1; j++ {
            for k := j + 1; k < n; k++ {
                if nums[i]+nums[j] > nums[k] {
                    res++
                } else {
                    break
                }
            }
        }
    }

    return res
}

// func helper(nums []int, res *int, pos int) {

// }
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.009768009768009768, 'mean_word_length': 1.4624624624624625, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4417569', 'n_tokens_mistral': 310, 'n_tokens_neox': 293, 'n_words': 82}