Click4Ai

215.

Easy

This problem involves calculating the cosine similarity between two text documents. **Example:** Given two documents 'This is a sample document' and 'This document is another sample', calculate their cosine similarity. **Constraints:** The input documents will be at most 1000 characters long.

Test Cases

Test Case 1
Input: 'This is a sample document', 'This document is another sample'
Expected: 0.5
Test Case 2
Input: 'The quick brown fox', 'The sun is shining'
Expected: 0.1
+ 3 hidden test cases